Thread Closed  Post Thread 

Explain the life-cycle mehtods in JSP?
Author Message
rominekarte
Junior Member



Posts: 3
Group: Registered
   
Cash: 0.00 Donate
Explain the life-cycle mehtods in JSP?

The generated servlet class for a JSP page implements the HttpJspPage interface of the javax.servlet.jsp package. Hte HttpJspPage interface extends the JspPage interface which inturn extends the Servlet interface of the javax.servlet package. the generated servlet class thus implements all the methods of the these three interfaces. The JspPage interface declares only two mehtods - jspInit() and jspDestroy() that must be implemented by all JSP pages regardless of the client-server protocol. However the JSP specification has provided the HttpJspPage interfaec specifically for the JSp pages serving HTTP requests. This interface declares one method _jspService().
The jspInit()- The container calls the jspInit() to initialize te servlet instance.It is called before any other method, and is called only once for a servlet instance.
The _jspservice()- The container calls the _jspservice() for each request, passing it the request and the response objects.
The jspDestroy()- The container calls this when it decides take the instance out of service. It is the last method called n the servlet instance.


acer coupon
02-23-2010 07:38 PM
Send the author a private message Find all posts by this author Quote this message in a reply
Affiliate Banner
This is an ad revenue sharing forum
kollkolen
Junior Member



Posts: 4
Group: Registered
   
Cash: 0.00 Donate
RE: Explain the life-cycle mehtods in JSP?

Well @ rominekarte!A JSP page services requests as a servlet. Thus, the life cycle and many of the capabilities of JSP pages (in particular the dynamic aspects) are determined by Java Servlet technology.
JSP page translation
JSP page compilation
load class
create instance
call the jspInit method
call the _jspService method
call the jspDestroy method
When a request is mapped to a JSP page, the web container first checks whether the JSP page’s servlet is older than the JSP page.


m3 zero
03-17-2010 06:49 PM
Send the author a private message Find all posts by this author Quote this message in a reply
novakaust
Junior Member



Posts: 3
Group: Registered
   
Cash: 0.00 Donate
RE: Explain the life-cycle mehtods in JSP?

Thanks for providing such a wonderful and valuable information for life- cycle methods in JSP, as I was also pursuing knowledge of java and its life cycle but not about JSP page


Sd cards
01-12-2011 05:37 AM
Send the author a private message Find all posts by this author Quote this message in a reply
johnpitter
Junior Member



Posts: 12
Group: Registered
   
Cash: 0.00 Donate
RE: Explain the life-cycle mehtods in JSP?

jsp life cycle has three important methods such as

- init() ->this initalizes the jsp information with the configuration
parameters.

- service : We have to Put business logic here. that is all the request and
responses goes here.

- destroy() : once the process is completed it will be killed.


Rx software|appointment booking software
02-03-2011 02:54 PM
Send the author a private message Find all posts by this author Quote this message in a reply

Thread Closed  Post Thread 


View a Printable Version | Send this Thread to a Friend | Subscribe to this Thread | Add Thread to Favorites
Rate This Thread:
Forum Jump: