Lifecycle of a JSP
You write the .jsp file.
The Container writes the .java file for the servlet your JSP becomes.
Kim writes a .jsp file, and deploys it as part of a web app.
The Container “reads” the web.xml (DD) for this app, but doesn’t do anything else with the .jsp file (until the first time it’s requested).
The client hits a link that asks for the .jsp.
The Container tries to TRANSLATE the .jsp into .java source code for a servlet class.
Note
JSP syntax errors are caught in this phase.
The Container tries to COMPILE the servlet .java source into a .class file.
The Container LOADS the newly-generated servlet class.
The Container instantiates the servlet and causes the servlet’s jspInit() method to run.
The object is now a full-fledged servlet, ready to accept client requests.
The Container creates a new thread to handle this client’s request, and the servlet’s _jspService() method runs.
Everything ...
Get Head First Servlets and JSP, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.