這是我的dispacter-servlet.xml文件。當我部署在樹脂親項目4.0.36加載我的索引頁面和內容,但無法加載staticresources文件夾下存儲的CSS文件和圖像調度器servlet映射資源(Resin Server)
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-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/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:component-scan base-package="com.dogears" />
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/pages/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
<import resource="classpath:beans.xml"/>
<mvc:resources mapping="/resources/**" location="/staticresources/" />
<mvc:annotation-driven />
請誰能告訴我如何映射我的靜態資源文件夾,以便無論何時請求是patter/resources/*,它都會將請求重定向到靜態資源文件夾。 staticresources文件夾位於MyspringProject/src/main/webapps目錄。
http://stackoverflow.com/questions/26325524/match-for-root-url-and-serving-of-static-resources – OO7
試試我的答案。願它幫助你。 – OO7