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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>The</strong> Example <strong>Java</strong>Server Faces Application<br />

318<br />

■ Navigation configured in a centralized application configuration resource file. This<br />

eliminates the need to calculate URLs, as other versions of the Duke’s Bookstore application<br />

must do.<br />

■ Backing beans associated with the pages. <strong>The</strong>se beans hold the component data and perform<br />

other processing associated with the components. This processing includes handling the<br />

event generated when a user clicks a button or a hyperlink.<br />

■ <strong>The</strong> table that displays the books from the database and the shopping cart are rendered with<br />

the dataTable tag, which is used to dynamically render data in a table. <strong>The</strong> dataTable tag<br />

on tut-install/javaeetutorial5/examples/web/bookstore6/web/bookshowcart.jsp also<br />

includes input components.<br />

■ <strong>The</strong> table that displays the books from the database uses a c:forEach JSTL tag,<br />

demonstrating that you can easily use <strong>Java</strong>Server Faces component tags with JSTL tags.<br />

■ A custom validator and a custom converter are registered on the credit card field of the<br />

bookcashier.jsp page.<br />

■ A value-change listener is registered on the Name field of bookcashier.jsp. This listener<br />

saves the name in a parameter so that<br />

tut-install/javaeetutorial5/examples/web/bookstore6/web/bookreceipt.jsp can<br />

access it.<br />

This version of Duke’s Bookstore includes the same pages listed in Table 5–1. It also includes the<br />

tut-install/javaeetutorial5/examples/web/bookstore6/web/chooselocale.jsp page,<br />

which displays the custom image map that allows you to select the locale of the application. This<br />

page is displayed first and advances directly to the bookstore.jsp page after the locale is<br />

selected.<br />

<strong>The</strong> packages of the Duke’s Bookstore application are:<br />

■ backing: Includes the backing bean classes<br />

■ components: Includes the custom UI component classes<br />

■ converters: Includes the custom converter class<br />

■ listeners: Includes the event handler and event listener classes<br />

■ model: Includes a model bean class<br />

■ renderers: Includes the custom renderers<br />

■ resources: Includes custom error messages for the custom converter and validator<br />

■ taglib: Includes custom tag handler classes<br />

■ util: Includes a message factory class<br />

■ validators: Includes a custom validator class<br />

<strong>The</strong> <strong>Java</strong> <strong>EE</strong> 5<strong>Tutorial</strong> • June 2010

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

Saved successfully!

Ooh no, something went wrong!