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.

In the case of the Guess Number example, the logical outcome is defined by the action attribute<br />

of the UICommand component that submits the form:<br />

<br />

To learn more about how navigation works, see “Navigation Model” on page 305.<br />

Configuring Error Messages<br />

In case the standard error messages don’t meet your needs, you can create new ones in resource<br />

bundles and configure the resource bundles in your application configuration resource file. <strong>The</strong><br />

guessNumber example has one custom converter message, as described in “Adding a Custom<br />

Message” on page 292.<br />

This message is stored in the resource bundle, ApplicationMessages.properties:<br />

userNoConvert=<strong>The</strong> value you entered is not a number.<br />

<strong>The</strong> resource bundle is configured in the application configuration file:<br />

<br />

<br />

guessNumber.ApplicationMessages<br />

ErrMsg<br />

<br />

<br />

<strong>The</strong> base-name element indicates the fully-qualified name of the resource bundle. <strong>The</strong> var<br />

element indicates the name by which page authors refer to the resource bundle with the<br />

expression language. Here is the inputText tag again:<br />

<br />

...<br />

<br />

A Simple <strong>Java</strong>Server Faces Application<br />

<strong>The</strong> expression on the converterMessage attribute references the userNoConvert key of the<br />

ErrMsg resource bundle.<br />

See “Registering Custom Error Messages” on page 445 for more information on configuring<br />

custom error messages.<br />

Chapter 10 • <strong>Java</strong>Server FacesTechnology 295

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

Saved successfully!

Ooh no, something went wrong!