Describe the life cycle methods of a jsp? , JAVA Programming

 

1. Pre-translated: Before the JSP file has been compiled and translated into the Servlet.

2. Translated: The JSP file has been compiled and translated as a Servlet.

3. Initialized: Prior to handling the requests in the service function the container calls the jspInit() to initialize the Servlet. Invoked only once per Servlet instance.

4. Servicing: Services the client requests. Container invokes the _jspService()  function for each request.

5. Out of service: The Servlet resource is out of service. The container invokes the jspDestroy() function.

Could you have your JSP-generated servlet subclass your own servlet instead of the default HttpServlet?

Your JSP started servlet may extend your own servlet with the directive:

<%@ page extends="com.CRMServlet"%>

But, you have to be very careful when having your JSP pages added your own servlet class.  By doing so you can lose any advanced optimization that can be given by your JSP engine.  If you do have a compelling problem to do so then your own superclass servlet has to fill the aspect with the JSP engine by:

1.  Providing the HttpJspPage interface for JspPage interface or HTTP protocol. If you do not then you will have to prepare that all your super-class servlet functions are defined as final.

2.  Implementing your super-class servlet functions as given:

  • The service() method has to call the _jspService() function.
  • The init() method has to call the jspInit() function.
  • The destroy() method has call jspDestroy() function.

If the above conditions are not present, then a translation error may be given by your JSP engine.

 

Posted Date: 7/25/2012 4:01:48 AM | Location : United States







Related Discussions:- Describe the life cycle methods of a jsp? , Assignment Help, Ask Question on Describe the life cycle methods of a jsp? , Get Answer, Expert's Help, Describe the life cycle methods of a jsp? Discussions

Write discussion on Describe the life cycle methods of a jsp?
Your posts are moderated
Related Questions
What is the difference between instance and object of a class? Few says both are same, then why java kept both the words for same thing?

EJB 2.0 has the additional advantages over the EJB 1.1 given below 1. Local interfaces : These are beans that can be needed locally, that means by the same Java Virtual Machi

1. Obtaining the new script: Download and save the attached comment CGI mailer script form-mail2.pl to your server's cgi-bin directory, and change the permissions on the script t

I need some Unique Idea About my final Year Project . It could be a Website or an Android application. I want to create Something very unique which in some sense benefits a society

We are in need of Programmer In search of someone who know java well enough to work under my in-house programmer and take work form him to keep the project moving. The project d

Development of an Android app urgent Project Description: I am searching for some good android developer who has depth in knowledge of making an app. I am focusing on a certa

write a program for loop

What is virtual function? While derived class overrides the base class method by redefining the same function, after that if client wants to access redefined the method from der

An aspect is the cross-cutting functionality that you are executing. It is the aspect of your application you are modularizing. An example of an aspect is logging. Logging is somet