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

To deploy the date application with NetBeans IDE, follow these steps:<br />

1. Start the Application Server.<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 date folder.<br />

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

6. Click Open Project.<br />

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

To deploy the date application with the Ant tool, follow these steps:<br />

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

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

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

file.<br />

3. Start the Application Server.<br />

4. Type ant deploy.<br />

To run the example, do the following:<br />

1. Set the character encoding in your browser to UTF-8.<br />

2. Open your browser to http://localhost:8080/date.<br />

3. You will see a combo box whose entries are locales. Select a locale and click Get Date. You<br />

will see the date expressed in a manner appropriate for that locale.<br />

Some of the characters might not display properly if you don’t have the appropriate language<br />

files installed on your machine. Consult the user guide or online help for your operating system<br />

to determine how you can install these language files.<br />

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

136<br />

To illustrate JSP technology, this chapter rewrites each servlet in the Duke’s Bookstore<br />

application introduced in “<strong>The</strong> Example Servlets” on page 100 as a JSP page (see Table 5–1).<br />

TABLE 5–1 Duke’s Bookstore Example JSP Pages<br />

Function JSP Pages<br />

Enter the bookstore. bookstore.jsp<br />

Create the bookstore banner. banner.jsp<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!