⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jspintro13.html

📁 j2eePDF格式的电子书
💻 HTML
字号:
<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">  <head>    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />    <meta http-equiv="Content-Style-Type" content="text/css" />    <title>Setting Properties for Groups of JSP Pages</title>    <link rel="StyleSheet" href="document.css" type="text/css" media="all" />    <link rel="StyleSheet" href="catalog.css" type="text/css" media="all" />    <link rel="Table of Contents" href="J2EETutorialTOC.html" />    <link rel="Previous" href="JSPIntro12.html" />    <link rel="Next" href="JSPIntro14.html" />    <link rel="Index" href="J2EETutorialIX.html" />  </head>  <body>    <table width="550" summary="layout" id="SummaryNotReq1">      <tr>	<td align="left" valign="center">	<font size="-1">	<a href="http://java.sun.com/j2ee/1.4/download.html#tutorial" target="_blank">Download</a>	<br>	<a href="http://java.sun.com/j2ee/1.4/docs/tutorial/information/faq.html" target="_blank">FAQ</a>	<br>	<a href="http://java.sun.com/j2ee/1.4/docs/tutorial/information/history.html" target="_blank">History</a>	</td>        <td align="center" valign="center"><a accesskey="p" href="JSPIntro12.html"><img id="LongDescNotReq1" src="images/PrevArrow.gif" width="26" height="26" border="0" alt="Prev" /></a><a accesskey="c" href="J2EETutorialFront.html"><img id="LongDescNotReq1" src="images/UpArrow.gif" width="26" height="26" border="0" alt="Home" /></a><a accesskey="n" href="JSPIntro14.html"><img id="LongDescNotReq3" src="images/NextArrow.gif" width="26" height="26" border="0" alt="Next" /></a><a accesskey="i" href="J2EETutorialIX.html"></a>        </td>	<td align="right" valign="center">	<font size="-1">	<a href="http://java.sun.com/j2ee/1.4/docs/api/index.html" target="_blank">API</a>	<br>	<a href="http://java.sun.com/j2ee/1.4/docs/tutorial/information/search.html" target="_blank">Search</a>	<br>	<a href="http://java.sun.com/j2ee/1.4/docs/tutorial/information/sendusmail.html" target="_blank">Feedback</a></font>	</font>	</td>      </tr>    </table>    <img src="images/blueline.gif" width="550" height="8" ALIGN="BOTTOM" NATURALSIZEFLAG="3" ALT="Divider">    <blockquote><a name="wp72193"> </a><h2 class="pHeading1">Setting Properties for Groups of JSP Pages</h2><a name="wp72222"> </a><p class="pBody">It is possible to specify certain properties for a group of JSP pages:</p><div class="pSmartList1"><ul class="pSmartList1"><a name="wp82426"> </a><div class="pSmartList1"><li>Expression language evaluation</li></div><a name="wp82430"> </a><div class="pSmartList1"><li>Treatment of scripting elements (see <a  href="JSPAdvanced4.html#wp74877">Disabling Scripting</a>)</li></div><a name="wp82431"> </a><div class="pSmartList1"><li>Page encoding</li></div><a name="wp82432"> </a><div class="pSmartList1"><li>Automatic prelude and coda includes</li></div></ul></div><a name="wp97347"> </a><p class="pBody">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 groupwith <code class="cCode">deploytool</code>:</p><div class="pSmartList1"><ol type="1" class="pSmartList1"><a name="wp97348"> </a><div class="pSmartList1"><li>Select the WAR.</li></div><a name="wp97349"> </a><div class="pSmartList1"><li>Select the JSP Properties tab.</li></div><a name="wp97350"> </a><div class="pSmartList1"><li>Click the Add button next to the Name list.</li></div><a name="wp97351"> </a><div class="pSmartList1"><li>Enter the name of the property group.</li></div><a name="wp97352"> </a><div class="pSmartList1"><li>Click the Add button next to the URL Pattern list.</li></div><a name="wp97353"> </a><div class="pSmartList1"><li>Enter the URL pattern (a / followed by a regular expression).</li></div></ol></div><a name="wp82439"> </a><p class="pBody">The following sections discuss the properties and how they are interpreted for various combinations of group properties, individual page directives, and Web application deployment descriptor version.</p><a name="wp83214"> </a><h4 class="pHeading3">Deactivating EL Evaluation</h4><a name="wp83263"> </a><p class="pBody">Each JSP page has a default mode for EL expression evaluation. The default value varies depending on the version of the Web application deployment descriptor. The default mode for JSP pages delivered using a Servlet 2.3 or earlier descriptor is to ignore EL expressions; this provides backwards compatibility. The default mode for JSP pages delivered with a Servlet 2.4 descriptor is to evaluate EL expressions; this automatically provides the default that most applications want. For tag files (see <a  href="JSPTags5.html#wp89664">Encapsulating Reusable Content using Tag Files</a>), the default is to always evaluate expressions. </p><a name="wp78208"> </a><p class="pBody">You can override the default mode through the <code class="cCode">isELIgnored</code> attribute of the <code class="cCode">page</code> directive in JSP pages and the <code class="cCode">isELIgnored</code> attribute of the <code class="cCode">tag</code> directive in tag files. The default mode can also be explicitly changed by setting the value of the EL Evaluation Ignored checkbox in the JSP Properties tab. <a  href="JSPIntro13.html#wp78166">Table 12-5</a> summarizes the EL evaluation settings for JSP pages and their meanings:</p><div align="left"><table border="1" summary="EL Evaluation Settings for JSP Pages" id="wp78166">  <caption><a name="wp78166"> </a><div class="pTableTitle">Table 12-5   EL Evaluation Settings for JSP Pages&nbsp;</div></caption>  <tr align="center">    <th><a name="wp78172"> </a><div class="pCellHeading">JSP Configuration</div></th>    <th><a name="wp78174"> </a><div class="pCellHeading">Page Directive<br />isELIgnored</div></th>    <th><a name="wp78176"> </a><div class="pCellHeading">EL Encountered</div></th></tr>  <tr align="left">    <td><a name="wp78178"> </a><div class="pCellBody">Unspecified</div></td>    <td><a name="wp78180"> </a><div class="pCellBody">Unspecified</div></td>    <td><a name="wp78182"> </a><div class="pCellBody">Evaluated if 2.4 <code class="cCode">web.xml</code></div><a name="wp78183"> </a><div class="pCellBody">Ignored if &lt;= 2.3 <code class="cCode">web.xml</code></div></td></tr>  <tr align="left">    <td><a name="wp78185"> </a><div class="pCellBody"><code class="cCode">false</code></div></td>    <td><a name="wp78187"> </a><div class="pCellBody">Unspecified</div></td>    <td><a name="wp78189"> </a><div class="pCellBody">Evaluated</div></td></tr>  <tr align="left">    <td><a name="wp78191"> </a><div class="pCellBody"><code class="cCode">true</code></div></td>    <td><a name="wp78193"> </a><div class="pCellBody">Unspecified</div></td>    <td><a name="wp78195"> </a><div class="pCellBody">Ignored</div></td></tr>  <tr align="left">    <td><a name="wp78197"> </a><div class="pCellBody">Overridden by page directive</div></td>    <td><a name="wp78199"> </a><div class="pCellBody"><code class="cCode">false</code></div></td>    <td><a name="wp78201"> </a><div class="pCellBody">Evaluated</div></td></tr>  <tr align="left">    <td><a name="wp78203"> </a><div class="pCellBody">Overridden by page directive</div></td>    <td><a name="wp78205"> </a><div class="pCellBody"><code class="cCode">true</code></div></td>    <td><a name="wp78207"> </a><div class="pCellBody">Ignored</div></td></tr></table></div><p class="pBody"></p><a name="wp78212"> </a><p class="pBody"><a  href="JSPIntro13.html#wp78216">Table 12-6</a> summarizes the EL evaluation settings for tag files and their meanings:</p><div align="left"><table border="1" summary="EL Evaluation Settings for Tag Files" id="wp78216">  <caption><a name="wp78216"> </a><div class="pTableTitle">Table 12-6   EL Evaluation Settings for Tag Files&nbsp;</div></caption>  <tr align="center">    <th><a name="wp78220"> </a><div class="pCellHeading">Tag Directive isELIgnored</div></th>    <th><a name="wp78222"> </a><div class="pCellHeading">EL Encountered</div></th></tr>  <tr align="left">    <td><a name="wp78224"> </a><div class="pCellBody">Unspecified</div></td>    <td><a name="wp78226"> </a><div class="pCellBody">Evaluated</div></td></tr>  <tr align="left">    <td><a name="wp78228"> </a><div class="pCellBody"><code class="cCode">false</code></div></td>    <td><a name="wp78230"> </a><div class="pCellBody">Evaluated</div></td></tr>  <tr align="left">    <td><a name="wp78232"> </a><div class="pCellBody"><code class="cCode">true</code></div></td>    <td><a name="wp78234"> </a><div class="pCellBody">Ignored</div></td></tr></table></div><p class="pBody"></p><a name="wp72252"> </a><h4 class="pHeading3">Declaring Page Encodings</h4><a name="wp81716"> </a><p class="pBody">You set the page encoding of a group of JSP pages by selecting a page encoding from the Page Encoding drop-down list. Valid values are the same as the <code class="cCode">pageEncoding</code> attribute of the <code class="cCode">page</code> directive. A translation-time error results if you define the page encoding of a JSP page with one value in the JSP configuration element and then give it a different value in a <code class="cCode">pageEncoding</code> directive.</p><a name="wp72261"> </a><h4 class="pHeading3">Defining Implicit Includes</h4><a name="wp72262"> </a><p class="pBody">You can implicitly include preludes and codas for a group of JSP pages by addingitems to the Include Preludes and Codas lists. Their values are context-relative paths that must correspond to elements in the Web application. When the elements are present, the given paths are automatically included (as in an <code class="cCode">include</code> directive) at the beginning and end of each JSP page in the property group respectively. When there is more than one include or coda element in a group, they are included in the order they appear. When more than one JSP property group applies to a JSP page, the corresponding elements will be processed in the same order as they appear in the JSP configuration section.</p><a name="wp97428"> </a><p class="pBody">For example, the Duke's Bookstore uses the files <code class="cCode">/template/prelude.jspf</code> and <code class="cCode">/template/coda.jspf</code> to include the banner and other boilerplate in each screen. To add these files to the Duke's Bookstore property group with <code class="cCode">deploytool</code>:</p><div class="pSmartList1"><ol type="1" class="pSmartList1"><a name="wp97429"> </a><div class="pSmartList1"><li>Define a property group with name <code class="cCode">bookstore2</code> and URL pattern <code class="cCode">*.jsp</code>.</li></div><a name="wp97430"> </a><div class="pSmartList1"><li>Click the Edit button next to the Include Preludes list.</li></div><a name="wp97431"> </a><div class="pSmartList1"><li>Click Add.</li></div><a name="wp97432"> </a><div class="pSmartList1"><li>Enter <code class="cCode">/template/prelude.jspf</code>.</li></div><a name="wp97433"> </a><div class="pSmartList1"><li>Click OK.</li></div><a name="wp97434"> </a><div class="pSmartList1"><li>Click the Edit button next to the Include Codas list.</li></div><a name="wp97435"> </a><div class="pSmartList1"><li>Click Add.</li></div><a name="wp97436"> </a><div class="pSmartList1"><li>Enter <code class="cCode">/template/coda.jspf</code>.</li></div><a name="wp97437"> </a><div class="pSmartList1"><li>Click OK.</li></div></ol></div><a name="wp75339"> </a><p class="pBody">Preludes and codas can only put the included code at the beginning and end of each file. For a more flexible approach to building pages out of content chunks, see <a  href="JSPTags7.html#wp90689">A Template Tag Library</a>.</p>    </blockquote>   <img src="images/blueline.gif" width="550" height="8" ALIGN="BOTTOM" NATURALSIZEFLAG="3" ALT="Divider">    <table width="550" summary="layout" id="SummaryNotReq1">      <tr>	<td align="left" valign="center">	<font size="-1">	<a href="http://java.sun.com/j2ee/1.4/download.html#tutorial" target="_blank">Download</a>	<br>	<a href="http://java.sun.com/j2ee/1.4/docs/tutorial/information/faq.html" target="_blank">FAQ</a>	<br>	<a href="http://java.sun.com/j2ee/1.4/docs/tutorial/information/history.html" target="_blank">History</a>	</td>        <td align="center" valign="center"><a accesskey="p" href="JSPIntro12.html"><img id="LongDescNotReq1" src="images/PrevArrow.gif" width="26" height="26" border="0" alt="Prev" /></a><a accesskey="c" href="J2EETutorialFront.html"><img id="LongDescNotReq1" src="images/UpArrow.gif" width="26" height="26" border="0" alt="Home" /></a><a accesskey="n" href="JSPIntro14.html"><img id="LongDescNotReq3" src="images/NextArrow.gif" width="26" height="26" border="0" alt="Next" /></a><a accesskey="i" href="J2EETutorialIX.html"></a>        </td>	<td align="right" valign="center">	<font size="-1">	<a href="http://java.sun.com/j2ee/1.4/docs/api/index.html" target="_blank">API</a>	<br>	<a href="http://java.sun.com/j2ee/1.4/docs/tutorial/information/search.html" target="_blank">Search</a>	<br>	<a href="http://java.sun.com/j2ee/1.4/docs/tutorial/information/sendusmail.html" target="_blank">Feedback</a></font>	</font>	</td>      </tr>    </table>    <img src="images/blueline.gif" width="550" height="8" ALIGN="BOTTOM" NATURALSIZEFLAG="3" ALT="Divider"><p><font size="-1">All of the material in <em>The J2EE(TM) 1.4 Tutorial</em> is <a href="J2EETutorialFront2.html">copyright</a>-protected and may not be published in other workswithout express written permission from Sun Microsystems.</font>  </body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -