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.

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

286<br />

■ Application architect, who configures the application, including defining the navigation<br />

rules, configuring custom objects, and creating deployment descriptors.<br />

This application is quite simple, and so it does not include any custom components. See chapter<br />

“Writing a Method to Handle a Value-Change Event” on page 405 to learn about the<br />

responsibilities of a component writer.<br />

Steps in the Development Process<br />

Developing a simple <strong>Java</strong>Server Faces application usually requires these tasks:<br />

■ Mapping the FacesServlet instance.<br />

■ Creating the pages using the UI component and core tags.<br />

■ Defining page navigation in the application configuration resource file.<br />

■ Developing the backing beans.<br />

■ Adding managed bean declarations to the application configuration resource file.<br />

<strong>The</strong> example used in this section is the guessNumber application, located in the<br />

tut-install/javaeetutorial5/examples/web/ directory. It asks you to guess a number between<br />

0 and 10, inclusive. <strong>The</strong> second page tells you whether you guessed correctly. <strong>The</strong> example also<br />

checks the validity of your input. <strong>The</strong> system log prints Duke’s number. Figure 10–2 shows what<br />

the first page looks like.<br />

FIGURE 10–2 <strong>The</strong> greeting.jsp Page of the guessNumber Application<br />

<strong>The</strong> source for the guessNumber application is located in the<br />

tut-install/javaeetutorial5/examples/web/guessNumber/ directory created when you unzip<br />

the tutorial bundle (see Chapter 2, “Using the <strong>Tutorial</strong> Examples”).<br />

To build, package, deploy, and run this example using NetBeans IDE, follow these steps:<br />

1. In NetBeans IDE, select File→Open Project.<br />

2. In the Open Project dialog, navigate to:<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!