This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSP and the fly likes JSP Lifecycle chain Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP Lifecycle chain" Watch "JSP Lifecycle chain" New topic

JSP Lifecycle chain

rosy leena

Joined: Dec 21, 2012
Posts: 2
I want to know about JSP Lifecycle methods

Thank you,
Divya Chandel
Ranch Hand

Joined: Jun 09, 2011
Posts: 46

May be this will help you

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. The life-cycle methods of the JSP are:

jspInit(): The container calls the jspInit() to initialize the servlet instance. It is called before any other method, and is called only once for a servlet instance.
_jspService(): The container calls the _jspService() for each request and it passes the request and the response objects. _jspService() method cann?t be overridden.
jspDestroy(): The container calls this when its instance is about to destroyed.

The jspInit() and jspDestroy() methods can be overridden within a JSP page.

These methods are generated after JSP page translated and compiled, the JSP pages's servlet follows the servlet life-cycle:

If an instance of the JSP page's servlet does not exist, the container
Loads the JSP page's servlet class
Instantiates an instance of the servlet class
Initializes the servlet instance by calling the jspInit method
The container invokes the _jspService method, passing request and response objects.

If the container needs to remove the JSP page's servlet, it calls the jspDestroy method.

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60822

Also read this article.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Don't get me started about those stupid light bulbs.
subject: JSP Lifecycle chain
Similar Threads
Is PageContext Works Same As Servlet Context
JSP container?
request time
jsp translate servlet method problem
in jsp what tags go where after compilation?