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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Using CustomTags<br />

172<br />

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

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

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

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

3. Select the iterator folder.<br />

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

5. Click Open Project.<br />

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

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

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

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

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

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

WAR file.<br />

3. Start the Application Server.<br />

4. Type ant deploy.<br />

5. To run the example, open your browser to http://localhost:8080/iterator.<br />

To learn how to configure the example, refer to the deployment descriptor, which includes the<br />

following configurations:<br />

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

■ Nested inside a jsp-config element is a taglib element, which provides information on a<br />

tag library used by the pages of the application. Inside the taglib element are the<br />

taglib-uri element and the taglib-location element. <strong>The</strong> taglib-uri element identifies<br />

the logical name of the tag library. <strong>The</strong> taglib-location element gives the absolute<br />

location or the absolute URI of the tag library.<br />

<strong>The</strong> absolute URIs for the JSTL library are as follows:<br />

■ Core: http://java.sun.com/jsp/jstl/core<br />

■ XML: http://java.sun.com/jsp/jstl/xml<br />

■ Internationalization: http://java.sun.com/jsp/jstl/fmt<br />

■ SQL: http://java.sun.com/jsp/jstl/sql<br />

■ Functions: http://java.sun.com/jsp/jstl/functions<br />

When you reference a tag library with an absolute URI that exactly matches the URI declared in<br />

the taglib element of the TLD (see “Tag Library Descriptors” on page 245), you do not have to<br />

add the taglib element to web.xml; the JSP container automatically locates the TLD inside the<br />

JSTL library implementation.<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!