table of contents
CSAJSP/2

Source Code Archive

Core Servlets and JavaServer Pages

Second Edition

Volume 1: Core Technologies


Chapter 12: Controlling the Structure of Generated Servlets: The JSP page Directive

Complete source code for every example from this chapter, available free for unrestricted use. Live links to all URLs cited in the chapter. More information. To view source code for other chapters in this book, mouse over the table of contents bar on the left.

Source Code from Chapter

Note: right-click or shift-click on the links to download the associated file.

  • ImportAttribute.jsp. JSP page that illustrates the import attribute of the page directive. Uses the CookieUtilities and LongLivedCookie classes. Also uses the JSP-Styles.css style sheet.
  • JSP-Styles.css. Style sheet used by many of the JSP pages in this chapter and throughout the book.
  • CookieUtilities.java. Utility class from Chapter 8 that simplifies the retrieval of cookie values. Remember that this class is in the coreservlets package and thus needs to go in the coreservlets subdirectory. Used by ImportAttribute.jsp.
  • LongLivedCookie.java. Utility class from Chapter 8 that automatically sets the cookie max age to one year. Remember that this class is in the coreservlets package and thus needs to go in the coreservlets subdirectory. Used by ImportAttribute.jsp.
  • Excel.jsp. JSP page that (unconditionally) generates an Excel spreadsheet. Illustrates the contentType attribute of the page directive.
  • ApplesAndOranges.jsp. JSP page that conditionally generates an Excel spreadsheet.
  • ComputeSpeed.jsp. JSP page that foolishly calls Double.parseDouble without catching NumberFormatException. Illustrates the errorPage attribute of the page directive.
  • SpeedErrors.jsp. JSP page that displays errors for ComputeSpeed.jsp. Illustrates the isErrorPage attribute of the page directive.

More Information

Java

JSF (JavaServer Faces)

Servlets & JSP
Ajax, GWT, & JavaScript

Spring, Hibernate, & JPA

Struts