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 Pages<br />

226<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 bookstore3 project, and select Undeploy and Deploy.<br />

8. To run the application, open the bookstore URL<br />

http://localhost:8080/bookstore3/bookstore.<br />

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

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

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

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

WAR file and copy it to the<br />

tut-install/javaeetutorial5/examples/web/bookstore3/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<br />

http://localhost:8080/bookstore3/bookstore.<br />

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

configurations:<br />

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

■ A context-param element that specifies the JSTL resource bundle base name.<br />

■ A listener element that identifies the ContextListener class used to create and remove<br />

the database access.<br />

■ A servlet element that identifies the Dispatcher instance.<br />

■ A set of servlet-mapping elements that map Dispatcher to URL patterns for each of the<br />

JSP pages in the application.<br />

■ Nested inside a jsp-config element is a jsp-property-group element, which sets the<br />

properties for the group of pages included in this version of Duke’s Bookstore. See “Setting<br />

Properties for Groups of JSP Pages” on page 177 for more information.<br />

To run the example, open the bookstore URL<br />

http://localhost:8080/bookstore3/bookstore.<br />

See “Troubleshooting Duke's Bookstore Database Problems” on page 102 for help with<br />

diagnosing common problems.<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!