what is the life cycle of jsp?

Answer Posted / sivasubramanian.k

It is similar to the lifecycle of a servlet only,
They are:
jsp:init()
jsp:service()
jsp:destroy()
The init() method initializes the servlet within jsp and
must be called before the servlet can service any requests.
In the entire life of a servlet, the init() method is
called only once.

After initialization, the servlet can service client-
requests. Each request is serviced in its own separate
thread. The container calls the service() method of the
servlet for every request. The service() method determines
the kind of request being made and dispatches it to an
appropriate method to handle the request. The developer of
the servlet must provide an implementation for these
methods. If a request for a method that is not implemented
by the servlet is made, the method of the parent class is
called, typically resulting in an error being returned to
the requester
.
Finally, the container calls the destroy() method which
takes the servlet out of service. The destroy() method like
init() is called only once in the lifecycle of a Servlet.

Is This Answer Correct ?    7 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is singleton class thread safe?

542


What are the fileinputstream and fileoutputstream?

571


What's the base class in java from which all classes are derived?

748


Can You Have Virtual Functions In Java?

590


Why does java not support pointers?

556






What is a functional interface?

549


How can constructor chaining be done using this keyword?

590


How many types of threads are there in java?

506


What is hash in java?

523


What are the java ide's? Explain

526


What are the two types of streams offered by java 8?

516


What is array length?

509


What is an example of a keyword?

550


What is early binding and late binding in java?

595


Is it possible to specify multiple jndi names when deploying an ejb?

561