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.

Unable to start plugin.<br />

<br />

<br />

Setting Properties for Groups of JSP Pages<br />

It is possible to specify certain properties for a group of JSP pages:<br />

■ Expression language evaluation<br />

■ Treatment of scripting elements (see “Disabling Scripting” on page 273)<br />

■ Page encoding<br />

■ Automatic prelude and coda includes<br />

Setting Properties for Groups of JSP Pages<br />

A JSP property group is defined by naming the group and specifying one or more URL patterns;<br />

all the properties in the group apply to the resources that match any of the URL patterns. If a<br />

resource matches URL patterns in more than one group, the pattern that is most specific<br />

applies.<br />

To define a property group in a deployment descriptor using NetBeans IDE, follow these steps:<br />

1. In NetBeans IDE, expand your project’s folder in the Projects pane.<br />

2. Expand the Web Pages node and then the WEB-INF node.<br />

3. Double-click web.xml to open it in the editor pane.<br />

4. Click Pages at the top of the editor pane.<br />

5. Click Add JSP Property Group.<br />

6. In the Add JSP Property Group dialog:<br />

a. Enter a name for the JSP property group in the Display Name field.<br />

b. Enter a URL pattern (a regular expression, such as *.jsp) or click Browse to indicate to<br />

which page or set of pages to apply the properties specified by the JSP property group.<br />

c. Click OK.<br />

Instead of performing the preceding steps, you can define a JSP property group by editing the<br />

XML by hand using NetBeans IDE by doing the following:<br />

1. Perform steps 1 through 3 in the preceding set of steps.<br />

2. Click XML at the top of the editor pane.<br />

3. Include a jsp-config element if the deployment descriptor doesn’t already have one.<br />

4. Add a jsp-property-group element inside the jsp-config element.<br />

5. Add a display-name element inside the jsp-property-group element and give it a name.<br />

6. Add a url-pattern element inside the jsp-property-group element and give it a URL<br />

pattern (a regular expression, such as *.jsp).<br />

Chapter 5 • <strong>Java</strong>Server PagesTechnology 177

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

Saved successfully!

Ooh no, something went wrong!