【发布时间】:2015-06-12 23:34:06
【问题描述】:
这是我的 dispacter-servlet.xml 文件。当我在resin pro 4.0.36上部署项目时,它会加载我的索引页面和内容,但无法加载存储在staticresources文件夹下的css文件和图像
<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 />
谁能告诉我如何映射我的静态资源文件夹,以便每当请求是模式 /resources/* 时,它将请求重定向到静态资源文件夹。 staticresources 文件夹位于 MyspringProject/src/main/webapps 目录。
【问题讨论】:
-
试试我的答案。希望对你有帮助。
标签: java maven spring-mvc resin