A JSP page must first be processed by a Web server before it can be displayed in a Web browser. The Web server must support JSP, and the JSP page must be stored in a file with a .jsp extension. The Web server translates the .jsp file into a Java servlet, compiles the servlet, and executes it. The result of the execution is sent to the browser for display. Figure 35.2 shows how a JSP page is processed by a Web server. CurrentTime.jsp in Figure 35.1 is translated into a servlet named CurrentTime_jsp.java in c:\jakarta-tomcat-5.5.9\work\standalone\localhost\liangweb . Viewing the file will help you to better understand that JSP is based on the servlet.
Note
A JSP page is translated into a servlet when the page is requested for the first time. It is not retranslated if the page is not modified. To ensure that the first-time real user does not get a delay, JSP developers may test the page after it is installed. |