绝对 uri:http://java.sun.com/jstl/core 无法在 web.xml 或使用此应用程序部署的 jar 文件中解析 [英] The absolute uri: http://java.sun.com/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
问题描述
我需要一些帮助,我想做一个程序并使用
i need some help, i wanted to do a program and used
if(session.getAttribute("logged")!="1"){
String err="You must be logged in!!";
request.setAttribute( "error", err );
String nextJSP = "/login.jsp";
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(nextJSP);
dispatcher.forward(request,response); }
%>
在一个jsp中,但是我的老板告诉我用jstl所以我把它改成了:
In a jsp, but my boss told me to use jstl So i changed it to:
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<c:if test="${session.getAttribute('logged')!=null}">
<jsp:forward page="login.jsp">
</jsp:forward>
</c:if>
<c:if test="${session.getAttribute('logged')==null}">
<jsp:forward page="princ.jsp"> </jsp:forward>
</c:if>
然后我得到一个严重的错误:
And i get a nasty error:
"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 "
我在互联网上搜索了一些修复程序,我已经将 javax.servlet.jsp.jstl-api-1.2.1-javadoc.jar 放在我的库中,甚至将 javaee.jar 放在 Tomcat 库中,但仍然得到没有解决方案,有人可以帮我吗?PS:我有 Eclipse Java EE IDE for Web Developers.(INDIGO) Tomcat 7.08
I searched the internet for some fixes, i've put the javax.servlet.jsp.jstl-api-1.2.1-javadoc.jar in my library, even put javaee.jar in the Tomcat library, but still got no solution to this, can somebody help me please? PS: i got Eclipse Java EE IDE for Web Developers.(INDIGO) Tomcat 7.08
推荐答案
您的 taglib URI 错误.
Your taglib URI is wrong.
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
这个 URI 来自旧的和 EOL 的 JSTL 1.0 库.从 JSTL 1.1 开始,路径中需要一个额外的 /jsp
因为 taglib 的内部工作发生了变化,因为 EL 部分从 JSTL 移到了 JSP:
This URI is from the old and EOL'ed JSTL 1.0 library. Since JSTL 1.1, you need an extra /jsp
in the path because the taglib's internal workings were changed because the EL part was moved from JSTL to JSP:
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
此外,您尝试放入 /WEB-INF/lib
中的 JAR 文件是错误的.javax.servlet.jsp.jstl-api-1.2.1-javadoc.jar
仅包含 JSTL javadoc,javaee.jar
包含整个 Java EE API可能是 deastreus,因为 Tomcat 已经附带了它的一部分(JSP/Servlet),这可能 冲突.
Further, the JAR files which you attempted to drop in /WEB-INF/lib
are wrong. The javax.servlet.jsp.jstl-api-1.2.1-javadoc.jar
is contains only the JSTL javadocs and the javaee.jar
contains the entire Java EE API which may be desastreus because Tomcat ships with parts of it already (JSP/Servlet) which may conflict.
将它们全部删除.您需要 jstl-1.2.jar 文件.
Remove them all. You need the jstl-1.2.jar file.
这篇关于绝对 uri:http://java.sun.com/jstl/core 无法在 web.xml 或使用此应用程序部署的 jar 文件中解析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!