Download
FAQ
History
HomeHomeNext API
Search
Feedback
Divider

The Example JSP Pages

This chapter describes the tasks involved in defining tags. The chapter illustrates the tasks with excerpts from the JSP version of the Duke's Bookstore application discussed in The Example JSP Pages rewritten to take advantage of several new custom tags:

The last section in the chapter, Examples, describes several tags in detail: a simplified iteration tag and the set of tags in the tutorial-template tag library.

The tutorial-template tag library defines a set of tags for creating an application template. The template is a JSP page with placeholders for the parts that need to change with each screen. Each of these placeholders is referred to as a parameter of the template. For example, a simple template could include a title parameter for the top of the generated screen and a body parameter to refer to a JSP page for the custom content of the screen. The template is created with a set of nested tags--definition, screen, and parameter--that are used to build a table of screen definitions for Duke's Bookstore and with an insert tag to insert parameters from the table into the screen.

Figure 18-1 shows the flow of a request through the following Duke's Bookstore Web components:

Request Flow Through Duke's Bookstore Components

Figure 18-1 Request Flow Through Duke's Bookstore Components

The source code for the Duke's Bookstore application is located in the <INSTALL>/jwstutorial12/examples/web/bookstore3/ directory created when you unzip the tutorial bundle (see About the Examples). A sample bookstore3.war is provided in <INSTALL>/jwstutorial12/examples/web/provided-wars/. To build, package, deploy, and run the example:

  1. Build and package the bookstore common files as described in Updating Web Applications.
  2. In a terminal window, go to <INSTALL>/jwstutorial12/examples/bookstore3/.
  3. Run Ant build. This target will spawn any necessary compilations and copy files to the <INSTALL>/jwstutorial12/examples/web/bookstore3/build/ directory.
  4. Start Tomcat.
  5. Perform all the operations described in Updating Web Applications.
  6. Run ant install-config. The install-config target notifies Tomcat that the new context is available.
  7. Open the bookstore URL
    http://localhost:8080/bookstore3/bookstore.

See Troubleshooting for help with diagnosing common problems.

Divider
Download
FAQ
History
HomeHomeNext API
Search
Feedback
Divider

All of the material in The Java(TM) Web Services Tutorial is copyright-protected and may not be published in other works without express written permission from Sun Microsystems.