Exams Attended

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Servlets Interview Questions and Answers

Ques 26. What is servlet context ?

The servlet context is an object that contains a servlet's view of the Web application within which the servlet is running. Using the context, a servlet can log events, obtain URL references to resources, and set and store attributes that other servlets in the context can use. (answer supplied by Sun's tutorial).

Is it helpful? Add Comment View Comments
 

Ques 27. Which interface must be implemented by all servlets?

Servlet interface.

Is it helpful? Add Comment View Comments
 

Ques 28. Explain the life cycle of Servlet.

Is it helpful? Add Comment View Comments
 

Ques 29. When is the servlet instance created in the life cycle of servlet? What is the importance of configuring a servlet?

An instance of servlet is created when the servlet is loaded for the first time in the container. Init() method is used to configure this servlet instance. This method is called only once in the life time of a servlet, hence it makes sense to write all those configuration details about a servlet which are required for the whole life of a servlet in this method.

Is it helpful? Add Comment View Comments
 

Ques 30. Why don't we write a constructor in a servlet?

Container writes a no argument constructor for our servlet.

Is it helpful? Add Comment View Comments
 

Most helpful rated by users:

©2021 WithoutBook