During the translation phase each type of data in a JSP page is treated differently. Static data is transformed into code that will emit the data into the response stream. JSP elements are treated as follows:
Scripting elements are inserted into the JSP page’s servlet class. See Chapter 9, Scripting in JSP Pages for details.
Expression language expressions are passed as parameters to calls to the JSP expression evaluator.
jsp:[set|get]Property elements are converted into method calls to JavaBeans components.
jsp:[include|forward]elements are converted into invocations of the Java Servlet API.
The jsp:plugin element is converted into browser-specific markup for activating an applet.
Custom tags are converted into calls to the tag handler that implements the custom tag.
In the Application Server, the source for the servlet created from a JSP page named pageName is in this file:
For example, the source for the index page (named index.jsp) for the date localization example discussed at the beginning of the chapter would be named:
Both the translation and the compilation phases can yield errors that are observed only when the page is requested for the first time. If an error is encountered during either phase, the server will return JasperException and a message that includes the name of the JSP page and the line where the error occurred.
After the page has been translated and compiled, the JSP page’s servlet (for the most part) follows the servlet life cycle described in 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.