background image

Setting Properties for Groups of JSP Pages

<< Duke's Bookstore with Applet | Deactivating EL Expression Evaluation >>
<< Duke's Bookstore with Applet | Deactivating EL Expression Evaluation >>

Setting Properties for Groups of JSP Pages

</jsp:fallback>
</jsp:plugin>
Setting Properties for Groups of JSP Pages
It is possible to specify certain properties for a group of JSP pages:
Expression language evaluation
Treatment of scripting elements (see
"Disabling Scripting" on page 275
)
Page encoding
Automatic prelude and coda includes
A JSP property group is defined by naming the group and specifying one or more URL patterns;
all the properties in the group apply to the resources that match any of the URL patterns. If a
resource matches URL patterns in more than one group, the pattern that is most specific
applies.
To define a property group in a deployment descriptor using NetBeans IDE, follow these steps:
1. In NetBeans IDE, expand your project's folder in the Projects pane.
2. Expand the Web Pages node and then the WEB-INF node.
3. Double-click web.xml to open it in the editor pane.
4. Click Pages at the top of the editor pane.
5. Click Add JSP Property Group.
6. In the Add JSP Property Group dialog:
a. Enter a name for the JSP property group in the Display Name field.
b. Enter a URL pattern (a regular expression, such as *.jsp) or click Browse to indicate to
which page or set of pages to apply the properties specified by the JSP property group.
c. Click OK.
Instead of performing the preceding steps, you can define a JSP property group by editing the
XML by hand using NetBeans IDE by doing the following:
1. Perform steps 1 through 3 in the preceding set of steps.
2. Click XML at the top of the editor pane.
3. Include a jsp-config element if the deployment descriptor doesn't already have one.
4. Add a jsp-property-group element inside the jsp-config element.
5. Add a display-name element inside the jsp-property-group element and give it a name.
6. Add a url-pattern element inside the jsp-property-group element and give it a URL
pattern (a regular expression, such as *.jsp).
Setting Properties for Groups of JSP Pages
Chapter 5 · JavaServer Pages Technology
179