【发布时间】:2017-07-16 15:27:12
【问题描述】:
`
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:cache="http://www.springframework.org/schema/cache"
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/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd http://www.springframework.org/schema/cache
http://www.springframework.org/schema/cache/spring-cache-3.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
<context:component-scan base-package="com.homebanking" />
<mvc:annotation-driven/>
<context:annotation-config />
<mvc:resources location="/css/*" mapping="/css/*"/>
<mvc:resources location="/js/*" mapping="/js/*"/>
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
<bean name="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/homebanking" />
<property name="username" value="root" />
<property name="password" value="root" />
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="packagesToScan" value="com.homebanking.model"/>
<property name="hibernateProperties">
<props>
<prop key="dialect">org.hibernate.dialect.MySQLDialect</prop>
</props>
</property>
</bean>
</beans>
`
我已经使用 mvc:resource 标签在 spring-servlet.xml 文件中映射了 css 文件。但是css没有加载。我已将 css 文件夹放在网页内容中
<mvc:resources location="/css/*" mapping="/css/*"/>
<mvc:resources location="/js/*" mapping="/js/*"/>
请帮帮我。它以前工作得很好。但突然 css 没有加载。
【问题讨论】:
-
你能告诉我你的文件夹结构和你的xml文件吗
-
我无法添加我的文件夹结构的图片
-
我已将 css 文件夹直接放在 webcontent 文件夹下
-
我已经添加了我的 spring .xml 文件
标签: java spring-mvc