ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE
Google
 
Categories >> Software >> Java-Related >> Java-J2EE >> Advanced-Java
 
 


 

Back to Questions Page
 
Question
Explain Life cycle of Servlet Filter.
Rank Answer Posted By  
 Question Submitted By :: Surajkumar.java
This Interview Question Asked @   ITC-Infotech
I also faced this Question!!   © ALL Interview .com
Answer
A java class which implements javax.servlet.Filter is 
configured as filter in web.xml file.
  The web container calls the init method to initialize filter 
by passing javax.servlet.FilterConfig object to retrieve the 
filter’s init parameters. 
  The doFilter method of Filter class performs the actual 
processing like authentication, data format conversion and 
page redirect to other page and catching etc. The doFilter 
method passes the request and response object of the current 
request and the filter chain object to invoke next filter in 
the chain.
  Web container calls the destroy() method to take the filter 
out of service.
 
0
Surajkumar.java
 
 
Question
What is Servlet Filter And What does it work?
Rank Answer Posted By  
 Question Submitted By :: Surajkumar.java
This Interview Question Asked @   TCS
I also faced this Question!!   © ALL Interview .com
Answer
Filters are powerful tools of Servlet platform. These are 
just like a servlet which plugs into the request handling 
process and executes in addition to the normal page 
processing. Filters manipulate both request and response in 
web application. Filters can be applied to any resources 
like HTML, graphics, a JSP page, servlet etc, served by a 
servlet engine. These are commonly used for authentication, 
data format conversion and page redirect to other page and 
catching etc.
   A java class which implements javax.servlet.Filter is 
configured as filter in web.xml file. For each request in 
web application, the servlet container decides which filters 
to apply, and adds those filters to a chain in the same 
order they appear in web.xml. As a filter is just like a 
servlet, it has its life cycle (init(), doFilter() and 
destroy() methods).
 
0
Surajkumar.java
 
 
Question
Explain the life cycle of servlet?
Rank Answer Posted By  
 Question Submitted By :: Surajkumar.java
This Interview Question Asked @   Cognizent
I also faced this Question!!   © ALL Interview .com
Answer
1. The servlet is controlled by the container in which the 
servlet has been deployed. When a request is made to a 
servlet, its mapping is searched in web.xml. If mapping 
found then the web container loads the servlet class and 
creates an instance of it and initializes (e.g servlet 
context parameters, database connections objects etc) the 
servlet instance by calling the init method.
2. Then invokes the service method, passing a request and 
response object. The service provided by a servlet is 
implemented in the service method of a GenericServlet and 
the doMethod methods (where Method can take the value like 
Get,  Delete,  Options,  Post,  Put, Trace) of an 
HttpServlet. Basically a service method extract information 
from the request, access external resources, and then 
populate the response based on that information.
3. The container calls destroy method to remove servlet 
instance. We also do some specialized handling like closing 
a connection, freeing the memory used by local variables etc 
by explicitly defining the destroy method inside a servlet 
class. 
 
0
Surajkumar.java
 
 
 
Question
Why does most servlets extend HttpServlet?
Rank Answer Posted By  
 Question Submitted By :: Surajkumar.java
This Interview Question Asked @   Accenture
I also faced this Question!!   © ALL Interview .com
Answer
Almost all servlets written today are designed to use the HTTP 
protocol, so most servlets currently extend the 
javax.servlet.http.HttpServlet class.
 
0
Surajkumar.java
 
 
Answer
All servlet classes extend the HttpServlet abstract class.
HttpServlet simplifies writing HTTP servlets by providing a
framework for handling the HTTP protocol. Because
HttpServlet is abstract, your servlet class must extend it
and override at least one of its methods. An abstract class
is a class that contains unimplemented methods and cannot be
instantiated itself.
 
2
Dhiraj
 
 
Question
What is servlet preinitialization
Rank Answer Posted By  
 Question Submitted By :: Surajkumar.java
This Interview Question Asked @   iFlex
I also faced this Question!!   © ALL Interview .com
Answer
A servlet is lazily loaded in servlet container of web or 
application server. This means, a servlet is not instantiated 
or initialized in servlet container as long as it has not been 
requested for the first time. A servlet can be preloaded and 
preinitialized with the help of <load-on-startup> of web.xml 
(deployment descriptor) file.The preloading of a servlet 
before any user request is called servlet preinitialization.
 
0
Surajkumar.java
 
 
Question
What is servlet preinitialization?
Rank Answer Posted By  
 Question Submitted By :: Guest
This Interview Question Asked @   iFlex
I also faced this Question!!   © ALL Interview .com
Answer
A servlet is lazily loaded in servlet container of web or 
application server. This means, a servlet is not instantiated 
or initialized in servlet container as long as it has not been 
requested for the first time. A servlet can be preloaded and 
preinitialized with the help of <load-on-startup> of web.xml 
(deployment descriptor) file.The preloading of a servlet 
before any user request is called servlet preinitialization.
 
0
Guest
 
 
Answer
 A servlet is lazily loaded in servlet container of web or 
application server. This means, a servlet is not instantiated 
or initialized in servlet container as long as it has not been 
requested for the first time. A servlet can be preloaded and 
preinitialized with the help of <load-on-startup> of web.xml 
(deployment descriptor) file.The preloading of a servlet 
before any user request is called servlet preinitialization.
 
0
Surajkumar.java
 
 
Answer
Servlet can loaded in servlet container of web or 
application server at the time of first request sent to 
that servlet.
If we want to preinitialized the servlet by using  <load-on-
startup> tag(Aritten in web.xml). If we use that tag, 
servlet is intialized at the time of server start.
 
0
Sreekanth Madamanchi
 
 
Question
What are Benefits of Connection Pooling?
Rank Answer Posted By  
 Question Submitted By :: Suraj Kumar
I also faced this Question!!   © ALL Interview .com
Answer
1. Connection pooling can improve the response time of any 
application that requires connections, especially Web-based 
applications.
2. The characteristics of the pool can be changed without 
affecting the application (e.g pointing to different vendor's 
database (Oracle, MySQL) without changing any code)
 
0
Suraj Kumar
 
 
Question
What is Connection Pooling?
Rank Answer Posted By  
 Question Submitted By :: Suraj Kumar
This Interview Question Asked @   Infosys
I also faced this Question!!   © ALL Interview .com
Answer
Connection pooling is conceptually similar to any other form 
of object pooling. Database connections are often expensive to 
create because of the overhead of establishing a network 
connection and initializing a database connection session. In 
turn, connection session initialization often requires time 
consuming processing to perform user authentication, establish 
transactional contexts and establish other aspects of the 
session that are required for subsequent database usage. 
Hence, sharing of connection object helps to both alleviate 
connection management overhead and decrease development tasks 
for data access. The sharing and storing mechanism of 
connection object is known as connection pooling.
 
0
Suraj Kumar
 
 
Question
life cycle of an applet?
Rank Answer Posted By  
 Question Submitted By :: Naguzz
I also faced this Question!!   © ALL Interview .com
Answer
yes because everyone is which is related to networking are 
implemented by an applet
 
0
Guest
 
 
Question
How to send a request to garbage collector?
Rank Answer Posted By  
 Question Submitted By :: Tathagata Choudhury
I also faced this Question!!   © ALL Interview .com
Answer
Garbage collection is implicitly accomplished with 
termination of instance.
Wee dont need to explicitly request.
 
0
Viiraj
 
 
Question
How to get an image from db2 database plz help as soon  as
possible
Rank Answer Posted By  
 Question Submitted By :: Rakesh
I also faced this Question!!   © ALL Interview .com
Answer
You can store images as binary data. BLOB's were supported
in JDBC2.0 archtecture and you can use JDBC getBLOB() to
retrieve binary datasets (and other SQL3 data types) similar
to the way you receive the standard sql data types ...
 
0
Haven
 
 
Question
What is diffennce between AWT & SWING?
Rank Answer Posted By  
 Question Submitted By :: Bsr.kanneganti
I also faced this Question!!   © ALL Interview .com
Answer
AWT are heavy weight components while Swing are light 
weight components.
 
0
Amar
 
 
Answer
A AWT is heavy-weight components, but Swing is light-weight 
components. AWT is OS dependent because it uses native 
components, But Swing components are OS independent. We can 
change the look and feel in Swing which is not possible in 
AWT. Swing takes less memory compared to AWT. For drawing 
AWT uses screen rendering where Swing uses double 
buffering.
 
5
Neela
[L&T]
 
 
Answer
AWT is heavy-weight components, but Swing is light-weight 
components. AWT is OS dependent but Swing components are OS 
independent.

Swing components can access data in the databases while AWT 
components are not.
 
0
Sure
[L&T]
 
 
Question
Wt is the main difference between Java and Java J2EE and 
Advanced java?
Rank Answer Posted By  
 Question Submitted By :: Sankaran
This Interview Question Asked @   Wipro
I also faced this Question!!   © ALL Interview .com
Answer
According sun Microsystem  java divided into 3 parts
  1.J2Se(core java+Advance java)
  2.j2EE
  3.j2Me
   j2SE is availible in the part of jdk software.

   j2EE is availible in the form specification its avialible
in the form thrid party vendors(weblogic.jar,classes111.jar)

  j2me used for mobile application
 
0
Paletipatisrinu
 
 
Answer
J2SE(standard edition)is for developing desktop 
applications. This constitutes the core of java language.

J2EE(enterprise edition) came up when there was a need for 
distributed programming. 

J2ME(micro eidtion) is a subset of J2SE and it is used for 
developing mobile applications.
 
0
Priya
[M.Sc., Student]
 
 
Answer
Both advanced java and core java together called J2SE.
J2ME delas with embedded applications like mobile games 
etc..
 
0
Saba
[M.Sc., Student]
 
 
 
Back to Questions Page
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com