Resin下使用jstl
在Resin2.x下使用jstl
Resin从2.1.2版本开始自己实现了JSTL的core和fmt两个TAGLIB。
使用Resin2.x自带的JSTL不需要拷贝JAR和TLD文件,也不需要配置web.xml。
只要在页面引用就可以了,注意与标准JSTL1.1的区别。
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
需要注意的是:
<c:out value="${myvar}"/> 是 JSTL 语法 , resin2.1.x版本支持,
而 ${myvar} 是 JSP 2.0 语法 resin 3.0 之后支持
在resin2.1.x中使用会产生java.lang.NoClassDefFoundError: javax/servlet/jsp/el/VariableResolver错误
在Resin3.x下使用jstl(未经验证)
将resin.conf文件的:
<servlet servlet-name="directory" servlet-class="com.caucho.servlets.DirectoryServlet"/>
改成:
<servlet servlet-name="directory" servlet-class="com.caucho.servlets.DirectoryServlet">
<init enable="false"/>
</servlet>
在resin.conf文件中添加你的webapp的配置,注意要加上
<jsp fast-jstl="false"/>
<web-app id="/jstltest" document-directory="jstltest"><jsp fast-jstl="false"/></web-app>
在jsp引用中
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
使用标准的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" %>
使用标准的JSTL1.0
需要将JAR包(jstl.jar和standard.jar)拷贝到WEB-INF/lib目录下,拷贝需要的TLD文件。
配置web.xml
<taglib>
<taglib-uri>/tags/jstl-c</taglib-uri>
<taglib-location>/WEB-INF/tld/c.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/jstl-fmt</taglib-uri>
<taglib-location>/WEB-INF/tld/fmt.tld</taglib-location>
</taglib>
在jsp引用
<%@ taglib uri="/tags/jstl-c" prefix="c" %>
<%@ taglib uri="/tags/jstl-fmt" prefix="fmt" %>
Tomcat下使用JSTL1.0
需要将JAR包(jstl.jar和standard.jar)拷贝到WEB-INF/lib目录下,拷贝需要的TLD文件。
配置web.xml
<taglib>
<taglib-uri>/tags/jstl-c</taglib-uri>
<taglib-location>/WEB-INF/tld/c.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/jstl-fmt</taglib-uri>
<taglib-location>/WEB-INF/tld/fmt.tld</taglib-location>
</taglib>
在jsp引用
<%@ taglib uri="/tags/jstl-c" prefix="c" %>
<%@ taglib uri="/tags/jstl-fmt" prefix="fmt" %>
Tomcat下使用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" %>
需要注意的是:
JSTL1.0是需要Servlet2.3和JSP1.2的。
JSTL1.1是需要Servlet2.4和JSP2.0的。
${myvar} 是JSP 2.0 语法,tomcat5以后的版本都支持JSP2.0也就是都支持EL语言。
但是为什么我们的应用程序发布到tomcat5服务器上后还是不支持EL语言呢,而且甚至不能发布成功。
这里涉及到web.xml文件的迁移问题
使用
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
是JSP1.2的语法,不支持EL语言。
需要把文件头换成
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
或者在每个jsp页面添加
<%@ page isELIgnored="false" %>
转自: http://xying.spaces.live.com/Blog/cns!C20F968B904CD5D6!130.entry
分享到:
相关推荐
解决如下异常 java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/ConditionalTagSupport 的解决办法。
Tomcat5.5 下使用JSTL1.1必须的两个jar包,版本为jstl-1.1.2.jar和standard1.1.2.jar
JSTL标签库-tomcat10-简化JSP中java代码
JSP Tomcat7 提示JSTL错误
使用jstl需要包含的3个jar 博文链接:https://pignut-wang.iteye.com/blog/54782
JSTL标签库依赖,内含Tomcat8、Tomcat10所需JSTL依赖
无法在web.xml或使用此应用程序部署的jar文件中解析绝对uri:[http://java.sun.com/jsp/jstl/core],解决办法:WEB/INF的lib下,除了导入jstl.jar包,还要导入standard.jar包。另外,解压standard.jar包,把.tld文件...
所使用的web应用服务器resin与tomcat有所区别 resin\lib目录下存在jstl-1.2.jar、jta-101.jar包 而tomcat目录下不存在这两个jar包 结论:在使用tomcat里要在web工程中引入以上两个jar包 以解决...
所使用的web应用服务器resin与tomcat有所区别 resin\lib目录下存在jstl-1.2.jar、jta-101.jar包 而tomcat目录下不存在这两个jar包 结论:在使用tomcat里要在web工程中引入以上两个jar包 以解决...
由于上传资源只能提供1个压缩包文件,所以把两套版本的jar包放在一起了,包括jdk8+tomcat9版本以下使用JSTL包和高版本的1.2版JSTL包,可以根据自己需要选择
有的时候在开发jsp时,需要使用jstl时,在jsp上面引用jstl却出现错误:Can not find the tag library descriptor for "http://java.sun.com/jsp/jstl/core,这是由于缺少两个jar包导致的。
The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or t 最终查到问题是 jstl.jar 包在ide项目中有,但在tomcat发布的应用WEB-INF/lib下没有,这是工具发布项目的问题,...
JSTL 1.0 jar包,最低可支持 Servlet2.3/JSP1.2。
JSTL 标签 发生 uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application问题时解决方法
添加依赖项到一个WEB应用程序: 在web应用程序中,添加以下JAR包到/web-inf/lib目录: - taglibs-standard-spec-1.2.5.jar ... <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
JSTL1.1包含两个部分standard.jar和jstl.jar 使用JSTL时tomcat5.5最好是使用jstl1.1。 使用jstl时如果出现java.lang.NoSuchMethodError: javax.servlet.jsp.PageContext.getELContext()Ljavax/el/ELContext;
jstl.jar和standard.jar。。下载这两个jar包,jstl.jar,standard.jar,放在WEB-IF下的lib下,然后buildPath导入这两个包即可
HTTP Status 500 - The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/ConditionalTagSupport 问题-附件资源
报错为:Can not find the tag library descriptor for "http://java.sun.com/jsp/jstl/