項目沒問題的,業務功能都能正常實現,后來為了添加JS文件,就設置靜態資源訪問,但是一旦設置之后jsp頁面就訪問不了,配置文件如下:(js文件在webroot目錄下,與WEB-INF平級)<?xml?version="1.0"?encoding="UTF-8"?>
<beans?xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"?
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"?
xmlns:mvc="http://www.springframework.org/schema/mvc"?
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans
???????????http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
???????????http://www.springframework.org/schema/context
???????????http://www.springframework.org/schema/context/spring-context-3.0.xsd
???????????http://www.springframework.org/schema/aop?
???????????http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
???????????http://www.springframework.org/schema/mvc
???????????http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
???????????http://www.springframework.org/schema/tx?
???????????http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
<!--?使spring掃描包下的所有類,讓標注spring注解的類生效?-->
<context:component-scan?base-package="/"?/>
<!--?對轉向頁面的路徑解析。prefix:前綴,?suffix:后綴?-->
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property?name="prefix"?value="/WEB-INF/jsp/"?/>
<property?name="suffix"?value=".jsp"?/>
</bean>
<!--?靜態資源文件訪問,SPRINGMVC中無法直接訪問靜態資源?-->
?<mvc:default-servlet-handler?/>
<!--?<mvc:resources?mapping?="/js/**,/css/**"?location="/js/,/css/"?/>? ?-->
</beans>
- 3 回答
- 0 關注
- 7383 瀏覽
添加回答
舉報
0/150
提交
取消