可能一: web项目出现如上问题,据查是版本问题: 可能二: 最终查到问题是 jstl.jar 包在ide项目中有,但在tomcat发布的应用WEB-INF/lib下没有,这是工具发布项目的问题,复制一个jar包过去问题就解决了。 >>jstl.jar没有 使用jstl的文档,这里有篇文档: http://www.mularien.com/blog/2008/04/24/how-to-reference-and-use-jstl-in-your-web-application/ As a frequent contributor to the Spring Framework user forums, I have noticed a common trend among people new to Spring MVC – they really don’t understand how to use JSTL and EL in their Spring-driven JSPs. Although Spring MVC supports flexibility in choosing a view technology, in my [back of the napkin] estimate, at least 80% of the time it is paired with JSP and JSTL. Unfortunately, since JSP was pushed out about 4-5 years ago, a lot of the information that you find on the web is extremely dated, often going back to JSTL 1.0 syntax (or, gasp, using scriptlets!). In this article I’ll clear up the confusion around how to use JSTL with various app servers and webapp versions. Here’s a hint: if you can’t get a simple (non-Spring-related!) expression like ${2+2} to work, no expressions will work! (In a properly functioning servlet container, the prior expression should output “4″ on the page). I set out to take some common application server configurations, combine them with various flavors of JSP/JSTL support, and see what happened. The Importance of Servlet Version and web.xml Let us review the following reference table: JSP/Servlet Version
What Does this mean to me? The most important thing is to figure out what version of the Java EE web stack (Servlet/JSP) you are using. There are 2 aspects that factor into this:
Here’s an example of what to look for in web.xml: <?xmlversion="1.0"encoding="UTF-8"?><web-appxmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"id="WebApp_ID"version="2.5"><display-name>web-app-25</display-name> ... </web-app>
You can see the ‘version=”2.5″‘ designation in here. This means that within this web application, we will be able to use JSP 2.1 and JSTL 1.2 features. OK, How do I use JSTL in my Page? A very common problem that I have seen with new Spring users is that they don’t understand how to reference the JSTL tag libraries on their pages. Important!: You need to identify the version of web application you are using first. Web Application v2.5 and v2.4 To use EL Expressions: You do not need <c:out>. Simply insert EL expressions onto the page: ${2+2} <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
Web Application v2.3 To use EL Expressions: You do need <c:out>. Raw EL expressions on the page will not work. e.g. <c:out value=”${2+2}”> <%@taglib prefix="c" uri="http://java.sun.com/jsp/core" %>
What about the _rt Taglibs Like core_rt? The following type of URI will also work, in JSTL 1.2 and 1.1: <%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
However, this is not desired. You should never have to reference the _rt versions of taglibs (e.g. core_rt). Do I need to include a JSTL Implementation with my Web Application? Obviously, there are a lot of application servers out there. I tested this with the following:
Of these, JBOSS and Glassfish ship with JSTL implementations out of the box. Tomcat does not ship with a JSTL implementation. I have previously blogged about this here. I did not test other application servers, simply because these are the ones I most commonly see referenced in the Spring forums. Websphere is also used, but I didn’t have access to it (and, frankly, didn’t want to spend the 8 hours and tens of gigs of downloads it would take to install it ). Testing Methodology For those who are interested, here’s the testing methodology I used to come to the conclusions above. I created 6 web applications. The 6 web applications are as follows:
In each web application, I created 4 JSP pages with the following content: Some simple math: ${2+2} <br/> Some simple math with c:out: <c:out value="${2+2}"/> <br/> Some simple math with c2:out: <c2:out value="${2+2}"/> <br/>
You can see there are 3 tests in the page. The goal of the tests are as follows:
For each of the 4 JSP pages, I varied how the JSTL core taglib was declared:
In a typical scenario where the container supports JSP 2.0+, what you would expect to see is the following: Some simple math: 4 What Happens if You Have the Wrong Declarations Some of the errors you may get if you don’t have things declared right: On Tomcat org.apache.jasper.JasperException: /test_c2_jstl_core_taglib_decl.jsp(11,32) According to TLD or attribute directive in tag file, attribute value does not accept any expressions No JSTL implementation: org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application org.apache.jasper.JasperException: 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 On JBOSS Since JBOSS also uses the Apache Jasper JSP compiler, the errors are basically exactly the same as those listed above. On Glassfish org.apache.jasper.JasperException: /test_c2_jstl_core_taglib_decl.jsp(11,32) PWC6236: According to TLD or attribute directive in tag file, attribute value does not accept any expressions |
- 浏览: 758016 次
- 性别:
- 来自: 南京
文章分类
- 全部博客 (663)
- Eclipse&MyEclipse (40)
- PHP (3)
- Java (72)
- CSS (3)
- MySQL (35)
- Oracle (68)
- Red Hat Linux (23)
- Tomcat (26)
- Oracle10gAS (1)
- Spring (28)
- MyBatis&iBatis (13)
- JS (47)
- JQuery (23)
- Editplus (2)
- 其他 (4)
- Html (15)
- SQL (5)
- Ant (2)
- Hadoop (2)
- Servlet (9)
- Windows (11)
- Flex (1)
- CentOS Linux (7)
- Microsoft SQL Server (2)
- DB2 (3)
- Mysql char 与 varchar 区别 (0)
- excel (5)
- jsp (8)
- FreeMarker (1)
- EasyUI (5)
- WebShpere MQ (1)
- Maven2 (6)
- 浏览器缓存 (2)
- visio (1)
- XML (2)
- 物联网 (1)
- Maven (3)
- JSTL (2)
- HTTP (1)
- Fourinone (1)
- IP知识 (1)
- MyBatis (1)
- 项目管理 (2)
- office2003+2007 (1)
- DOS (1)
- JProfiler (1)
- Thinpad T440p (1)
- ActiveMQ (10)
- MongoDB (5)
- Vert.x3 (1)
- Ngnix (3)
- Spark (2)
- BigData (1)
- 性能概念公式 (1)
- RocketMQ (3)
- IT名词术语 (1)
- Java编程工具 (1)
- RabbitMQ (2)
- MetaMQ (1)
- 架构 (6)
- KafkaMQ (7)
- Redis (4)
- OAuth (1)
- Gradle (1)
- CentOS (5)
- Microsoft_Toolkit (1)
- git (5)
- IntelliJ Idea (4)
- Nginx (3)
- docker (12)
- VMware (2)
- 算法 (1)
- JDBCPool (1)
- spring-cloud (7)
- netbean (1)
- 微信小程序 (2)
- CURL (2)
- Java生成二维码 (1)
- 区块链 (2)
- 机器学习 (1)
- SpringBoot (3)
- Android (9)
- 微服务架构 (1)
- Kubernetes (2)
- OpenProject (0)
- 测试 (1)
- https (1)
- 开源许可证 (1)
- ServiceMesh (2)
- NET (0)
- .NET (1)
- TEST (1)
- iOS (2)
- thymeleaf (4)
- lombok (1)
- 浏览器设置 (1)
- 富文本编辑器 (1)
- 搜索引擎 (1)
- IT常识 (1)
- UML (0)
- Axure (1)
- appstore无法联网 (0)
- apk无法安装 (1)
- SQLServer (2)
- 卸载弹窗软件 (1)
- jenkins (1)
- TortoiseGit (1)
- eureka (1)
- ajax (1)
- spyder (0)
最新评论
The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar
发表评论
-
Servlet 3.0 新特性详解 (转)
2016-03-17 11:18 468Servlet 3.0 新特性概览 1.Servle ... -
Session生命周期(转)
2014-06-05 22:23 713文章级别:Java初级 预备技能点:JSP内置对象, 监听器 ... -
No mapping found for HTTP request with URI [/rbac/index.jsp] in DispatcherServl
2013-10-14 12:48 0在浏览器中的地址中:输入 1. http://local ... -
Servlet 过滤器Filter(转)
2013-10-12 22:19 958一,什么是Servlet过滤器? 1,过滤器 过滤器是在数 ... -
Servlet 过滤器Filter(转)
2013-10-12 22:16 1043一,什么是Servlet过滤器? 1,过滤器 过滤器是在数 ... -
servlet3.x新特性示例(转)
2013-09-11 10:33 1213源:http://www.iteye.com/ne ... -
关于request.getSession(true/false/null)的区别 (转)
2012-12-21 22:14 2556关于request.getSession(true/f ... -
Servlet 学习 (转)
2012-02-29 10:47 1027import java.io.IOException; imp ... -
Servlet 上传文件(转)
2011-07-13 16:38 1824这里只使用Servlet,先用apache fileuploa ...
相关推荐
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
jetty的main启动代码及相关jar包: ...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 导入jsp-api.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下没有,这是工具发布项目的问题,...
**The absolute uri:http://java.sun.com/jsp/jstl/core(也可能是http://java.sun.com/jstl/core) cannot be resolved in either web.xml or the jar files deployed** 可能二:项目目录下WEB-INF/lib下没有jstl.jar...
这个是一个jar包,适用于...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,遇到这种报错信息,多半是缺少jar包。
当出现类似 `org.apache.jasper.JasperException: 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` 的异常时,这通常...
解决struts2中报错:“HTTP Status 500 - org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this ...
关于The absolute uri: http://java.sun.com/jstl/core_rt cannot be resolved in either web.xml or the jar files deployed with this application解决! 将jstl.jar和standard.jar包导入工程后,运行页面依然...
当遇到类似`org.apache.jasper.JasperException: 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`这样的异常时,...
在尝试访问`WEB-INF/jsp`页面时,可能会遇到如下的错误提示:“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”。...