jstl taglib的錯誤 Can not find the tag library descriptor for “http://java.sun.com/jstl/core”

我遇到的錯誤是:

Can not find the tag library descriptor for “http://java.sun.com/jstl/core”

按照查到的資料,JSTL taglib需要jstl.jar來支持。在1.0和1.1版本的時候,還需要standard.jar來配合。但從1.2版本開始,jar文件名字變成了jstl-1.2.jar,也不再需要standard.jar了。另外,servlet 版本需要2.4以上。所以正確的做法是把jstl-1.2.jar放到WEB-INF/lib裏面就可以了。或者通過maven來配置,如下:

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>jstl</artifactId>
    <version>1.2</version>
</dependency>


然後在運行時看到這個錯誤:

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
這是uri錯誤。在jstl.jar版本1.0和1.1的時候,名字裏面沒有“jsp”。但是1.2版本後變成了http://java.sun.com/jsp/jstl/core了,改好後解決。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章