« | August 2025 | » | 日 | 一 | 二 | 三 | 四 | 五 | 六 | | | | | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | | | | | | | |
| 公告 |
戒除浮躁,读好书,交益友 |
Blog信息 |
blog名称:邢红瑞的blog 日志总数:523 评论数量:1142 留言数量:0 访问次数:9692272 建立时间:2004年12月20日 |

| |
[j2ee]jstl使用的兼容性问题  原创空间, 文章收藏, 软件技术, 电脑与网络
邢红瑞 发表于 2008/8/19 14:10:05 |
说实话,除了tomcat外,所有的的servlet容器对jstl支持都不是很好1 IBM 的WAS,在开发的时候用了JSTL的包,需要在web.xml的
<jsp-property-group> <url-pattern>*.jsp</url-pattern> <el-ignored>true</el-ignored> </jsp-property-group>2 Resin resin比较复杂,Resin从2.1.2版本开始自己实现了JSTL的core和fmt两个TAGLIB。 使用Resin2.x自带的JSTL不需要拷贝JAR和TLD文件,也不需要配置web.xml。 只要在页面引用就可以了,JSTL1.0是需要Servlet2.3和JSP1.2的,JSTL1.1是需要Servlet2.4和JSP2.0的。在resin.conf文件中添加你的webapp的配置,注意要加上 <jsp fast-jstl="false"/> 例如 <web-app id="/" document-directory="t"><jsp fast-jstl="false"/></web-app>
使用标准的JSTL1.1 ,需要将JAR包(jstl.jar和standard.jar)拷贝到WEB-INF/lib目录下,不需要拷贝TLD文件,不需要配置web.xml,容器会自动寻找。 页面<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> web.xml中配置,否则<c:forEach> 不会执行循环 <jsp-config> <jsp-property-group> <url-pattern>*.jsp</url-pattern> <el-ignored>false</el-ignored> <page-encoding>GBK</page-encoding> </jsp-property-group> </jsp-config>3 Spring 2.0Spring 2.0 中提供了 bean scope 功能,可以把 bean 放到 request, session, application 中去,这样在与 Shale 的 Spring Intergration 整合实现更简单的 Managed-Bean 配置,和更强大的 AOP 支持能力,但是所有的所有的 JSTL 将变得不可用。4 jsf 的不兼容性JSF和JSTL都是sun的标准,JSTL使用的是Apache的基于1.1 Spec的实现,JSF是myfaces 1.1.1,实现了JSF 1.1 Spec。JSF Spec (Section 9.2.8) 中有如下定义: JSF component custom actions nested inside a custom action that conditionally renders its body (such as JSTL’s <c:if> or <c:choose>) must contain a manually assigned id attribute.
JSF component custom actions may not be nested inside a custom action that iterates over its body (such as JSTL’s <c:forEach>). Instead, you should use a Renderer that performs its own iteration (such as the Table renderer used by <h:dataTable>).
dataTable中的每一行是由dataTable自己迭代产生的,这些数据并不能被JSTL或者其他的非JSF Tag使用,同样,使用<c:forEach>这样的非JSF Tag迭代产生的数据也不能够被JSF使用,建议在 JSF 里除非迫不得已,尽量少用 JSTL。4 Struts2Struts2.0.11以后不再支持EL表达式了,建议大家使用OGNL。 |
|
|