0

使用 JSTL 时出现错误。请帮助我。

我在我的 tomcat 7 中使用 jstl-impl-1.2.jar 和 jstl-api-1.2.jar,我取出了 standard.jsp 和 jstl.jsp 但仍然遇到这个错误。

错误代码

java.lang.AbstractMethodError: javax.servlet.jsp.PageContext.getELContext()Ljavax/el/ELContext;
javax.servlet.jsp.jstl.core.LoopTagSupport.unExposeVariables(LoopTagSupport.java:624)

Web.xml

<web-app 
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
4

2 回答 2

1

你的/WEB-INF/lib,或者更糟的是,你的JRE/liborJRE/lib/ext被特定于 servletcontainer 的库所污染,例如jsp-api.jar不同的旧版本的 servletcontainer make/version。您需要在 webapp 的/WEB-INF/lib. 这些库应该已经由 servletcontainer 本身提供,在您的情况下是 Tomcat。

在您的特定示例中,javax.servlet.jsp.PageContext.getELContext()Tomcat 的内部类请求该方法仅从 JSP 2.1 开始存在,但在 JSP API 中找不到它,因为您的webapp 在类加载方面优先于 Tomcat 自己的。

换句话说,在您将 JSTL 升级到与 Tomcat 6 兼容的版本之前,您的 Tomcat 7 一直像 Tomcat 5.5 或更早版本一样运行。

也可以看看:

于 2013-02-25T11:29:59.513 回答
0

Sounds like versioning problem,maybe a conflicting jar file of some sort. See this may help.

于 2013-02-25T11:26:08.510 回答