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.

<strong>The</strong> Example JSP Document<br />

184<br />

document books.jspx, which accesses the book data from the database and converts it into the<br />

XML stream. <strong>The</strong> bookstore5 application accesses this XML stream to get the book data.<br />

<strong>The</strong>se applications show how easy it is to generate XML data and stream it between web<br />

applications. <strong>The</strong> books application can be considered the application hosted by the book<br />

warehouse’s server. <strong>The</strong> bookstore5 application can be considered the application hosted by<br />

the book retailer’s server. In this way, the customer of the bookstore web site sees the list of<br />

books currently available, according to the warehouse’s database.<br />

<strong>The</strong> source for the Duke’s Bookstore application is located in the<br />

tut-install/javaeetutorial5/examples/web/bookstore5/ directory, which is created when<br />

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

To deploy the books 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 IDE, select File→Open Project.<br />

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

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

4. Select the books 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 books project, and select Undeploy and Deploy.<br />

To deploy the books application using the Ant utility, follow these steps:<br />

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

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

tut-install/javaeetutorial5/examples/web/books/build/ directory, build a WAR file,<br />

and copy the WAR file to the tut-install/javaeetutorial5/examples/web/books/dist/<br />

directory.<br />

3. To deploy the application, type ant deploy.<br />

To deploy and run the bookstore5 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 IDE, select File→Open Project.<br />

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

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

4. Select the bookstore5 folder.<br />

5. Select the Open as Main Project check box and the Open Required Projects check box.<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!