The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar

   由于在项目中引入了jstl和shiro标签,导致jsp无法解析,报错内容如下:

    org.apache.jasper.JasperException: /index.jsp (line: 2, column: 0) The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application The absolute uri: http://shiro.apache.org/tags cannot be resolved in either web.xml or the jar files deployed with this application] with root cause

引入内容:

<%@ page trimDirectiveWhitespaces="true" isELIgnored="false" session="false" %>
<%@ taglib prefix="c"   uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn"  uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>

 网上的解决方案实在很多,不过好多并不适合,或许大家遇到的具体问题不太一样吧

下面介绍下笔者所遇到的情况供大家参考。

1  依赖包

 
     
   
		1.1.2
		3.0.1
	
	
		
			javax.servlet
			javax.servlet-api
			${servlet.version}
			provided
		
		
			javax.servlet
			jsp-api
			2.0
			provided
		
		
			javax.servlet
			jstl
			${jstl.version}
		
		
			taglibs
			standard
			${jstl.version}
		
	      

 

 

 

2  tomcat (笔者使用的为apache-tomcat-7.0.69)下加入jstl和standard的jar包(高版本tomcat可能不需要)

3  web.xml引入本地tld文件

 


     
	    http://java.sun.com/jsp/jstl/core
	    /WEB-INF/c.tld
    
    
	    http://java.sun.com/jsp/jstl/functions
	    /WEB-INF/fn.tld
    
    
	    http://java.sun.com/jsp/jstl/fmt
	    /WEB-INF/fmt.tld
    
    
	    http://shiro.apache.org/tags
	    /WEB-INF/shiro.tld
    
  

ok,可以正常访问了。

参考:

https://blog.csdn.net/broccoli2/article/details/71173401
https://stackoverflow.com/questions/19926554/pwc6188-the-absolute-uri-http-java-sun-com-jsp-jstl-core-cannot-be-resolved
https://stackoverflow.com/tags/jstl/info
https://blog.csdn.net/lzz313/article/details/7554736
http://ljhzzyx.blog.163.com/blog/static/3838031220128196100902/

 

 

 

 

你可能感兴趣的:(java,web)