The absolute uri: http://java.sun.com/jsp/jstl/core cannot b

可能一:

web项目出现如上问题,据查是版本问题:JSTL 1.0 的声明是:<%@ taglib prefix="c" uri=" " %>JSTL1.1 的声明是:<%@ taglib prefix="c" uri=http://java.sun.com/jsp/jstl/core %>项目中,已经是 jstl 1.2 版本了,页面中也全部是用<%@ taglib prefix="c" uri=http://java.sun.com/jsp/jstl/core %>这种方式。javaee5之后就只有 jstl.jar 这一个jar包了,,没有standard.jar包,tld文件也打包到jar里面去了,啥在web.xml文件里配置jsp-config的解决方式也是浮云。

可能二:

最终查到问题是 jstl.jar 包在ide项目中有,但在tomcat发布的应用WEB-INF/lib下没有,这是工具发布项目的问题,复制一个jar包过去问题就解决了。

>>jstl.jar没有

使用jstl的文档,这里有篇文档:

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.Since JSP implementation and support varies widely among app server vendors (and versions of an app server), a lot of Spring MVC newbies get stuck just getting simple JSTL expressions to work. Since Spring relies on JSTL EL expressions for output of bound fields (assuming you’re not using the form taglibs), people often wrongly assume that something is wrong with Spring when their Spring-bound data doesn’t show up on the page.

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

Servlet VersionJSP VersionJSTL VersionJava EE 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:

What version of Java EE / servlet spec does your servlet container support?What version of Java EE / servlet spec have you declared in your deployment descriptor (web.xml)?

Here’s an example of what to look for in web.xml:

==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 donotneed <c:out>. Simply insert EL expressions onto the page: ${2+2}To use JSTL tag libraries (c, fmt, etc): Reference as follows:

<%@taglib prefix="c" uri="" %>

Web Application v2.3

To use EL Expressions: Youdoneed <c:out>. Raw EL expressions on the page will not work. e.g. <c:out value=”${2+2}”>To use JSTL tag libraries (c, fmt, etc): Reference as follows:

<%@taglib prefix="c" uri="" %>

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="" %>

However, this is not desired. You shouldneverhave 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:

青春气贯长虹,勇敢盖过怯懦,进取压倒苟安。

The absolute uri: http://java.sun.com/jsp/jstl/core cannot b

相关文章:

你感兴趣的文章:

标签云: