Java Servlets Question and Answers

17. What is the life cycle of a Servlet?
  Three methods are central to the life cycle of a Servlet
  • init()
  • service()
  • destroy()
 
Your Name Your Email-ID
Your Answer
18. What must be implemented by all Servlets?
  The Servlet Inteface must be implemented by all servlets.
 
Your Name Your Email-ID
Your Answer
19. What is the difference between ServletContext and PageContext?
  ServletContext: Gives the information about the container.
PageContext: Gives the information about the Request.
 
Your Name Your Email-ID
Your Answer
20. Why do you use Session Tracking in HTTPServlet?
  In HTTPServlet you can use Session Tracking to track the user state. Session is required if you are developing shopping cart application or in any e–commerce application.
 
Your Name Your Email-ID
Your Answer
1234567891011 Page 5 of 11