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

时间:2023-09-20 13:49:44

偶在页面里引入了标签如下:   
  <%@   taglib   prefix="c"   uri="http://java.sun.com/jstl/core"   %>   
  出错提示:   
    
  org.apache.jasper.JasperException:   /index.jsp(0,0)   This   absolute   uri   (http://java.sun.com/jstl/core)   cannot   be   resolved   in   either   web.xml   or   the   jar   files   deployed   with   this   application   
  at   org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:94)   
  at   org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:428)   
  at   org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:126)   
  at   org.apache.jasper.compiler.Parser.processIncludeDirective(Parser.java:307)   
  at   org.apache.jasper.compiler.Parser.parseIncludeDirective(Parser.java:340)   
  at   org.apache.jasper.compiler.Parser.parseDirective(Parser.java:378)   
  at   org.apache.jasper.compiler.Parser.parseElements(Parser.java:795)   
  at   org.apache.jasper.compiler.Parser.parse(Parser.java:122)   
  at   org.apache.jasper.compiler.ParserController.parse(ParserController.java:199)   
  at   org.apache.jasper.compiler.ParserController.parse(ParserController.java:153)   
  at   org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:227)   
  at   org.apache.jasper.compiler.Compiler.compile(Compiler.java:369)   
  at   org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:473)   
  at   org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:190)   
  at   org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)   
  at   org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)   
  at   javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

对于JAVAEE5.0及以上版本,使用的是jstl1.2.jar的版本,很简单,只需要将jstl1.2.jar拷贝到Tomcat安装目录下的lib下即可。

对于jstl1.1.jar的话,则需要在web.xml中增加taglib,引入对tld文件,还要加上standard.jar。