Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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
Author

Compiling jsp to servlet-Concept

James Winfrey
Ranch Hand

Joined: Jan 04, 2009
Posts: 60
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?

Thanks
James
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1647
    
  25

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?
Regards,
Frits
James Winfrey
Ranch Hand

Joined: Jan 04, 2009
Posts: 60
Thanks a lot Frits.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Compiling jsp to servlet-Concept
 
Similar Threads
Difference in opening binary stream in jsp & servlet
Compler Errors
JSP .class and .xml files generation
JSP - Compile errors because of includes
deployment environment can only have complied file?