File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Compiling jsp to servlet-Concept Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Compiling jsp to servlet-Concept" Watch "Compiling jsp to servlet-Concept" New topic

Compiling jsp to servlet-Concept

James Winfrey
Ranch Hand

Joined: Jan 04, 2009
Posts: 62
Hi Rancheers

I have a few doubts in the jsp compiling to servlet process.

when is the jsp translated into java servlet source code?
when is the java servlet source code compiled to java class?
when is the servlet first loaded, instantiated,initialized?

Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper

Joined: Apr 07, 2010
Posts: 2092

Hi James,

According to the JSP specifications: JSP.1.1.4

A JSP container manages two phases of a JSP page s lifecycle. In the translation
phase, the container validates the syntactic correctness of the JSP pages and tag
files and determines a JSP page implementation class that corresponds to the JSP
page. In the execution phase the container manages one or more instances of this
class in response to requests and other events.

and furthermore about the translation phase:

The translation of a JSP source page into its implementation class can occur at
any time between initial deployment of the JSP page into the JSP container and
the receipt and processing of a client request for the target JSP page.

When you define a JSP page in a servlet element with a load-on-startup element, it will be instantiated at the start of the application, otherwise the container decides

Does this answer your questions?
James Winfrey
Ranch Hand

Joined: Jan 04, 2009
Posts: 62
Thanks a lot Frits.
I agree. Here's the link:
subject: Compiling jsp to servlet-Concept
jQuery in Action, 3rd edition