close

今天在練習使用JSTL標籤庫於JSP頁面中時,發現會噴以下的錯誤訊息:
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


jstp_error.png
而原先我只有很直覺的用Maven加進了JSTL的Dependency,相關的POM內容如下:

        <dependency>
            <groupId>javax.servlet.jsp.jstl</groupId>
            <artifactId>javax.servlet.jsp.jstl-api</artifactId>
            <version>1.2.1</version>
        </dependency>

後來查找了幾篇網路文章後,最後我採取的解決方法為加入了taglibs-standard-spectaglibs-standard-impl這兩個Dependency
相關POM如下所示:

        <dependency>
            <groupId>org.apache.taglibs</groupId>
            <artifactId>taglibs-standard-spec</artifactId>
            <version>1.2.5</version>
        </dependency>
        <dependency>
            <groupId>org.apache.taglibs</groupId>
            <artifactId>taglibs-standard-impl</artifactId>
            <version>1.2.5</version>
        </dependency>

老實說我不確定這是不是正規的解決方法,但目前這樣是可以run的
如果知道更正確解法的朋友還請跟我說一聲,感謝:)
暫時先筆記下來~~如果我有找到更好解法會再補充上來!

參考資料:
1. http://stackoverflow.com/questions/4928271/how-to-install-jstl-the-absolute-uri-http-java-sun-com-jstl-core-cannot-be-r
2. http://stackoverflow.com/questions/20068903/add-jstl-to-tomcat-targeted-webapp-using-maven
3. http://stackoverflow.com/questions/6094329/tomcat-7-and-jstl

 

arrow
arrow
    文章標籤
    JSP Servlet Maven JSTL
    全站熱搜

    allen0818 發表在 痞客邦 留言(0) 人氣()