background image

Value-Change Listener

<< Using JavaServer Faces Technology | Deploy the Example Application >>
<< Using JavaServer Faces Technology | Deploy the Example Application >>

Value-Change Listener

Navigation configured in a centralized application configuration resource file. This
eliminates the need to calculate URLs, as other versions of the Duke's Bookstore application
must do.
Backing beans associated with the pages. These beans hold the component data and perform
other processing associated with the components. This processing includes handling the
event generated when a user clicks a button or a hyperlink.
The table that displays the books from the database and the shopping cart are rendered with
the dataTable tag, which is used to dynamically render data in a table. The dataTable tag
on tut-install/javaeetutorial5/examples/web/bookstore6/web/bookshowcart.jsp also
includes input components.
The table that displays the books from the database uses a c:forEach JSTL tag,
demonstrating that you can easily use JavaServer Faces component tags with JSTL tags.
A custom validator and a custom converter are registered on the credit card field of the
bookcashier.jsp
page.
A value-change listener is registered on the Name field of bookcashier.jsp. This listener
saves the name in a parameter so that
tut-install/javaeetutorial5/examples/web/bookstore6/web/bookreceipt.jsp can
access it.
This version of Duke's Bookstore includes the same pages listed in
Table 5­1
. It also includes the
tut-install/javaeetutorial5/examples/web/bookstore6/web/chooselocale.jsp page,
which displays the custom image map that allows you to select the locale of the application. This
page is displayed first and advances directly to the bookstore.jsp page after the locale is
selected.
The packages of the Duke's Bookstore application are:
backing
: Includes the backing bean classes
components
: Includes the custom UI component classes
converters
: Includes the custom converter class
listeners
: Includes the event handler and event listener classes
model
: Includes a model bean class
renderers
: Includes the custom renderers
resources
: Includes custom error messages for the custom converter and validator
taglib
: Includes custom tag handler classes
util
: Includes a message factory class
validators
: Includes a custom validator class
The Example JavaServer Faces Application
The Java EE 5 Tutorial · September 2007
320