項(xiàng)目沒問題的,業(yè)務(wù)功能都能正常實(shí)現(xiàn),后來(lái)為了添加JS文件,就設(shè)置靜態(tài)資源訪問,但是一旦設(shè)置之后jsp頁(yè)面就訪問不了,配置文件如下:(js文件在webroot目錄下,與WEB-INF平級(jí))<?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掃描包下的所有類,讓標(biāo)注spring注解的類生效?-->
<context:component-scan?base-package="/"?/>
<!--?對(duì)轉(zhuǎn)向頁(yè)面的路徑解析。prefix:前綴,?suffix:后綴?-->
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property?name="prefix"?value="/WEB-INF/jsp/"?/>
<property?name="suffix"?value=".jsp"?/>
</bean>
<!--?靜態(tài)資源文件訪問,SPRINGMVC中無(wú)法直接訪問靜態(tài)資源?-->
?<mvc:default-servlet-handler?/>
<!--?<mvc:resources?mapping?="/js/**,/css/**"?location="/js/,/css/"?/>? ?-->
</beans>
- 3 回答
- 0 關(guān)注
- 7377 瀏覽
添加回答
舉報(bào)
0/150
提交
取消