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.

“UISelectItems Properties” on page 383 describes in more detail how to write a backing bean<br />

property for a UISelectItems component.<br />

Using the selectItem Tag<br />

<strong>The</strong> selectItem tag represents a single item in a list of items. Here is the example from<br />

“Displaying a Menu Using the selectOneMenu Tag” on page 342:<br />

<br />

<br />

<br />

<br />

<br />

<strong>The</strong> itemValue attribute represents the default value of the SelectItem instance. <strong>The</strong><br />

itemLabel attribute represents the String that appears in the drop-down menu component on<br />

the page.<br />

<strong>The</strong> itemValue and itemLabel attributes are value-binding-enabled, meaning that they can use<br />

value-binding expressions to refer to values in external objects. <strong>The</strong>y can also define literal<br />

values, as shown in the example selectOneMenu tag.<br />

Displaying Error Messages with the message and<br />

messages Tags<br />

<strong>The</strong> message and messages tags are used to display error messages when conversion or<br />

validation fails. <strong>The</strong> message tag displays error messages related to a specific input component,<br />

whereas the messages tag displays the error messages for the entire page.<br />

Here is an example message tag from the guessNumber application, discussed in “Steps in the<br />

Development Process” on page 286:<br />

<br />

<br />

<br />

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

Saved successfully!

Ooh no, something went wrong!