eclipse 绝对 uri:http://java.sun.com/jstl/core 无法在 web.xml 或使用此应用程序部署的 jar 文件中解析
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9976281/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
The absolute uri: http://java.sun.com/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
提问by rosu alin
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); }
%>
%>
In a jsp, but my boss told me to use jstl So i changed it to:
在jsp中,但我的老板告诉我使用jstl所以我将其更改为:
<%@ 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 "
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
我在互联网上搜索了一些修复程序,我将 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
回答by BalusC
Your taglib URI is wrong.
你的 taglib URI 是错误的。
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
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:
此 URI 来自旧的 EOL JSTL 1.0 库。从 JSTL 1.1 开始,您需要/jsp
在路径中添加额外的内容,因为标记库的内部工作发生了变化,因为 EL 部分已从 JSTL 移至 JSP:
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
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.
此外,您尝试放入的 JAR 文件/WEB-INF/lib
是错误的。该javax.servlet.jsp.jstl-api-1.2.1-javadoc.jar
是只包含JSTL的javadoc和javaee.jar
包含整个Java EE API这可能是因为desastreus Tomcat的附带已经(JSP / Servlet的),这可能它的一部分发生冲突。
Remove them all. You need the jstl-1.2.jarfile.
将它们全部删除。您需要jstl-1.2.jar文件。
See also:
也可以看看:
回答by Ramesh PVK
I think you should include jstl impl jar. Here is one location of the jar i found:
我认为你应该包括 jstl impl jar。这是我找到的罐子的一个位置:
回答by rickz
Also, instead of
另外,代替
<c:if test="${session.getAttribute('logged')!=null}">
use one of the following
使用以下之一
<c:if test="${sessionScoped.logged != null}">
<c:if test="${sessionScoped[logged] != null}">
<c:if test="${logged != null}">