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.

<br />

<br />

<br />

Hi. My name is Duke. I’m thinking of a number from<br />

to<br />

.<br />

Can you guess it?<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

See “Using Command Components for Performing Actions and Navigation” on page 333 for<br />

more information on the commandButton tag.<br />

Displaying Error Messages<br />

A message tag is used to display error messages on a page when data conversion or validation<br />

fails after the user submits the form. <strong>The</strong> message tag in greeting.jsp displays an error<br />

message if the data entered in the field does not comply with the rules specified by the<br />

LongRangeValidator implementation, whose tag is registered on the text field component.<br />

<strong>The</strong> error message displays wherever you place the message tag on the page. <strong>The</strong> message tag’s<br />

style attribute allows you to specify the formatting style for the message text. Its for attribute<br />

refers to the component whose value failed validation, in this case the userNo component<br />

represented by the inputText tag in the greeting.jsp page.<br />

Put the message tag near the end of the page:<br />

<br />

<br />

<br />

<br />

Hi. My name is Duke. I’m thinking of a number from<br />

to<br />

.<br />

Can you guess it?<br />

<br />

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

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

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

Saved successfully!

Ooh no, something went wrong!