<jsp-config> 包括 <taglib> 和 <jsp-property-group> 两个子元素。其中<taglib> 元素在JSP 1.2 时就已经存在;而<jsp-property-group> 是JSP 2.0 新增的元素。<jsp-property-group> 元素主要有八个子元素,它们分别为:
1.<description>:设定的说明
2.<display-name>:设定名称
3.<url-pattern>:设定值所影响的范围,如: /CH2 或 /*.jsp
4.<el-ignored>:若为 true,表示不支持 EL 语法
5.<scripting-invalid>:若为 true,表示不支持 <% scripting %>语法
6.<page-encoding>:设定 JSP 网页的编码
7.<include-prelude>:设置 JSP 网页的抬头,扩展名为 .jspf
8.<include-coda>:设置 JSP 网页的结尾,扩展名为 .jspf
1.<description>:设定的说明
2.<display-name>:设定名称
3.<url-pattern>:设定值所影响的范围,如: /CH2 或 /*.jsp
4.<el-ignored>:若为 true,表示不支持 EL 语法
5.<scripting-invalid>:若为 true,表示不支持 <% scripting %>语法
6.<page-encoding>:设定 JSP 网页的编码
7.<include-prelude>:设置 JSP 网页的抬头,扩展名为 .jspf
8.<include-coda>:设置 JSP 网页的结尾,扩展名为 .jspf
贴一个简单配置:
view plaincopy to clipboardprint?
<jsp-config>
<jsp-property-group>
<url-pattern>*.jsp</url-pattern>
<scripting-invalid>true</scripting-invalid>
<include-prelude>/jsp/segments/taglibs.jspf</include-prelude>
<include-coda>/jsp/segments/coda.jspf</include-coda>
</jsp-property-group>
<jsp-property-group>
<url-pattern>*.do</url-pattern>
<scripting-invalid>true</scripting-invalid>
<include-prelude>/jsp/segments/taglibs.jspf</include-prelude>
<include-prelude>/jsp/segments/coda.jspf</include-prelude>
</jsp-property-group>
</jsp-config>
<jsp-config>
<jsp-property-group>
<url-pattern>*.jsp</url-pattern>
<scripting-invalid>true</scripting-invalid>
<include-prelude>/jsp/segments/taglibs.jspf</include-prelude>
<include-coda>/jsp/segments/coda.jspf</include-coda>
</jsp-property-group>
<jsp-property-group>
<url-pattern>*.do</url-pattern>
<scripting-invalid>true</scripting-invalid>
<include-prelude>/jsp/segments/taglibs.jspf</include-prelude>
<include-prelude>/jsp/segments/coda.jspf</include-prelude>
</jsp-property-group>
</jsp-config>
<jsp-config>
<jsp-property-group>
<url-pattern>*.jsp</url-pattern>
<scripting-invalid>true</scripting-invalid>
<include-prelude>/jsp/segments/taglibs.jspf</include-prelude>
<include-coda>/jsp/segments/coda.jspf</include-coda>
</jsp-property-group>
<jsp-property-group>
<url-pattern>*.do</url-pattern>
<scripting-invalid>true</scripting-invalid>
<include-prelude>/jsp/segments/taglibs.jspf</include-prelude>
<include-prelude>/jsp/segments/coda.jspf</include-prelude>
</jsp-property-group>
</jsp-config>
<jsp-config>
<jsp-property-group>
<url-pattern>*.jsp</url-pattern>
<scripting-invalid>true</scripting-invalid>
<include-prelude>/jsp/segments/taglibs.jspf</include-prelude>
<include-coda>/jsp/segments/coda.jspf</include-coda>
</jsp-property-group>
<jsp-property-group>
<url-pattern>*.do</url-pattern>
<scripting-invalid>true</scripting-invalid>
<include-prelude>/jsp/segments/taglibs.jspf</include-prelude>
<include-prelude>/jsp/segments/coda.jspf</include-prelude>
</jsp-property-group>
</jsp-config>
以上配置指明在所有*.jsp,*.do的路径中投不能是使用scriptlet(jsp 脚本),因为这会是java代码和html代码混杂在一起,稀释了代码的清晰度,增加项目维护难度。include-prelude设置每个文件的抬头为/jsp/segments/taglibs.jspf,include-prelude设置了每个文件的结尾/jsp/segments/coda.jspf,记住,引入的文件必须是以.jspf为后缀的jsp插件框架文件。
通过引入抬头和结尾可以做一些标签申明和版权申明等类似工作。觉得很值得提倡!