10.12.2012 Views

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>The</strong> table of screen definitions is filled in by ScreenTag and ParameterTag from text provided<br />

as attributes to these tags. Table 8–14 shows the contents of the screen definitions hash table for<br />

the Duke’s Bookstore application.<br />

TABLE 8–14 Screen Definitions<br />

Screen ID Title Banner Body<br />

/bookstore Duke’s Bookstore /banner.jsp /bookstore.jsp<br />

/bookcatalog Book Catalog /banner.jsp /bookcatalog.jsp<br />

/bookdetails Book Description /banner.jsp /bookdetails.jsp<br />

/bookshowcart Shopping Cart /banner.jsp /bookshowcart.jsp<br />

/bookcashier Cashier /banner.jsp /bookcashier.jsp<br />

/bookreceipt Receipt /banner.jsp /bookreceipt.jsp<br />

If the URL passed in the request is /bookstore, the Definition object contains the items from<br />

the first row of Table 8–14 (see Table 8–15).<br />

TABLE 8–15 Definition Object Contents for URL /bookstore<br />

Title Banner Body<br />

Duke’s Bookstore /banner.jsp /bookstore.jsp<br />

<strong>The</strong> parameters for the URL /bookstore are shown in Table 8–16. <strong>The</strong> parameters specify that<br />

the value of the title parameter, Duke’s Bookstore, should be inserted directly into the output<br />

stream, but the values of banner and body should be included dynamically.<br />

TABLE 8–16 Parameters for the URL /bookstore<br />

Parameter Name ParameterValue isDirect<br />

title Duke’s Bookstore true<br />

banner /banner.jsp false<br />

body /bookstore.jsp false<br />

Programming SimpleTag Handlers<br />

tut-install/javaeetutorial5/examples/web/bookstore3/src/java/com/sun/bookstore3/template<br />

inserts parameters of the screen definition into the response. <strong>The</strong> doTag method retrieves the<br />

definition object from the page context and then inserts the parameter value. If the parameter is<br />

direct, it is directly inserted into the response; otherwise, the request is sent to the parameter,<br />

and the response is dynamically included into the overall response.<br />

Chapter 8 • CustomTags in JSP Pages 269

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!