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.

Chapter 12, “Developing with <strong>Java</strong>Server Faces Technology,” describes how to program backing<br />

beans, custom converters and validators, and event listeners. Chapter 13, “Creating Custom UI<br />

Components,” describes how to program event handlers, custom components, renderers, and<br />

tag handlers.<br />

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

tut-install/javaeetutorial5/examples/web/bookstore6/ directory.<br />

To deploy and run the application using NetBeans IDE, follow these steps:<br />

1. Perform all the operations described in “Accessing Databases from Web Applications” on<br />

page 97.<br />

2. In NetBeans 5.5, select File→Open Project.<br />

3. In the Open Project dialog, navigate to:<br />

tut-install/javaeetutorial5/examples/web/<br />

4. Select the bookstore6 folder.<br />

5. Select the Open as Main Project check box and the Open Required Projects check box.<br />

6. Click Open Project.<br />

7. In the Projects tab, right-click the bookstore6 project, and select Undeploy and Deploy.<br />

8. To run the application, open the bookstore URL http://localhost:8080/bookstore6.<br />

To deploy and run the application using Ant, follow these steps:<br />

<strong>The</strong> Example <strong>Java</strong>Server Faces Application<br />

1. In a terminal window, go to tut-install/javaeetutorial5/examples/web/bookstore6/.<br />

2. Type ant. This target will spawn any necessary compilations, copy files to the<br />

tut-install/javaeetutorial5/examples/web/bookstore6/build/ directory, and create a<br />

WAR file and copy it to the<br />

tut-install/javaeetutorial5/examples/web/bookstore6/dist/ directory.<br />

3. Start the Application Server.<br />

4. Perform all the operations described in “Creating a Data Source in the Application Server”<br />

on page 98.<br />

5. To deploy the example, type ant deploy. <strong>The</strong> deploy target outputs a URL for running the<br />

application. Ignore this URL, and instead use the one shown in the next step.<br />

6. To run the application, open the bookstore URL http://localhost:8080/bookstore6/.<br />

To learn how to configure the example, refer to the web.xml file, which includes the following<br />

elements:<br />

■ A display-name element that specifies the name that tools use to identify the application.<br />

■ A context-param element that specifies that the javax.faces.STATE_SAVING_METHOD<br />

parameter has a value of client, meaning that state is saved on the client.<br />

Chapter 11 • Using <strong>Java</strong>Server FacesTechnology in JSP Pages 319

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

Saved successfully!

Ooh no, something went wrong!