開發常見bug故障列表
1.Spring “The prefix ”tx“ for element ”tx:annotation-driven“ is not bound.”
答案:
Just like your other xmlns: definations, you need one for xmlns:tx
xmlns:tx="http://www.springframework.org/schema/tx"
來源:stackoverflow
2.but no declaration can be found for element 'mvc:default-servlet-handler'.
答案:
問題的癥結是在spring-mvc中有一個對靜態資源所做的一個處理,但是在spring標頭檔案中所引進的是用
xmlns:mvc="http://www.springframework.org/schema/cache"
而正確的處理應當是
xmlns:mvc="http://www.springframework.org/schema/mvc"
3.exception is java.lang.NoClassDefFoundError
這個問題最主要的是servletapi中有幾個jar包沒有新增進去,處理servlet需要用到的幾個包如下
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>${javaee-api.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
複製程式碼