这是我的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