Chapter 10 - The JSP technology model - The basics

This application contains the following components discussed in chapter 10. Clicking on the links below will execute the JSP pages on the server.

JSP Page Description Explained in
counter.jsp Shows the use of various JSP syntax elements Section 10.1, Listing 10.1
persistent_counter.jsp Explains JSP life cycle methods- jspInit(), _jspService(), and jspDestroy() Section 10.2.4, Listing 10.2
hello.jsp Throws an exception because the name parameter is not passed. The exception is caught by errorHandler.jsp that prints the appropriate message. This example shows how to use the page directive attributes - errorPage and isErrorPage Section 10.3.3, Listing 10.3, 10.4
hello.jsp?name=john Does not throw an exception because the name parameter is passed. The errorHandler.jsp page is not called in this case. Section 10.3.3, Listing 10.3, 10.4
threadSafety.jsp Shows how to use the page directive attribute - isThreadSafe. The JSP page code contains a loop that executes 10 times and the thread uses Thread.currentThread().sleep(1000). So it will take a little more than 10 seconds for the reply. Please be patient. For the purpose of demonstration, the link on the left opens three windows. Observe the output in all three of them.
Note: Tomcat may not start a new thread for the third request. In such a case, the third window will get a response only after Tomcat processes the requests from the first two.
Section 10.3.6, Listing 10.5

Important

After you see the results of executing the above JSP pages, take a look at the source files, modify them, and practice the various concepts explained in this chapter.