SpringMVC專案中常見問題以及解決方案
一、org.apache.jasper.JasperException: 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
1、問題原因:
缺少相關jar(jstl.jar,和standard.jar) 包
2、 解決方法:
在Maven倉庫中http://www.mvnrepository.com/search?q=standard.jar
搜尋這兩個jar包,並將依賴項新增到pom.xml檔案中。
二、程式執行時,報錯內容如下:
The requested resource is not available.
出錯原因:在jsp中,action處理路徑寫錯,如下所示:
正確的寫法是:action=”user.do”
相應地在這裡展示下控制器中路徑和web.xml中的路徑配置
三、Web工程在執行時報錯“java.lang.ClassNotFoundException: org.apache.jsp.index_jsp
”
原因:與JSP有關的Jar包沒有匯入
解決方法:
在pom.xml中匯入一下內容:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
詳細內容請參考附件