当前位置: 代码迷 >> Java Web开发 >> Resource interpreted as Stylesheet but transferred with MIME type text/html解决方法
  详细解决方案

Resource interpreted as Stylesheet but transferred with MIME type text/html解决方法

热度:5203   发布时间:2016-04-10 22:38:55.0
Resource interpreted as Stylesheet but transferred with MIME type text/html
好好的突然css js加载不了了,之前也就改了几个jsp controller,求大神看破真相

springmvc配置文件
<?xml version="1.0" encoding="UTF-8"?>  
<beans xmlns="http://www.springframework.org/schema/beans" 
 xmlns:context="http://www.springframework.org/schema/context" 
 xmlns:mvc="http://www.springframework.org/schema/mvc" 
 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.2.xsd 
      http://www.springframework.org/schema/context 
      http://www.springframework.org/schema/context/spring-context-3.2.xsd 
      http://www.springframework.org/schema/mvc 
      http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd"> 
    
     <context:component-scan base-package="controller" /> 
     <mvc:annotation-driven /> 
     <mvc:resources location="/img/" mapping="/img/**"/> 
     <mvc:resources location="/css/" mapping="/css/**"/>
     <mvc:resources location="/js/" mapping="/js/**"/>
     <mvc:resources location="/font-awesome/" mapping="/font-awesome/**"/>
     <mvc:resources location="/style/" mapping="/style/**"/>
     <mvc:interceptors>
          <mvc:interceptor>
<mvc:mapping path="/um/**"/>              
<bean class="interceptor.UserInterceptor" />
          </mvc:interceptor>
      </mvc:interceptors>
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
    <property name="maxUploadSize" value="1000000" />
</bean>
<!-- ViewResolver -->  
<bean id="viewResolver" class="org.springframework.web.servlet.view.ResourceBundleViewResolver">
  <property name="basename" value="views"/>
  <property name="order" value="1"/>
</bean>
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">  
     <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
     <property name="prefix" value="/"/>  
     <property name="suffix" value=".jsp"/>  
</bean> 
</beans>  

web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
  <display-name>Caiyuanzi</display-name>
    
  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath*:applicationContext*.xml</param-value>
  </context-param>
  <context-param>
    <param-name>log4jConfigLocation</param-name>
    <param-value>classpath:log4j.properties</param-value>
  </context-param>
  <servlet>
    <servlet-name>hello</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>hello</servlet-name>
    <url-pattern>/</url-pattern>
  </servlet-mapping>

  <listener>
    <listener-class> 
     org.springframework.web.util.Log4jConfigListener 
     </listener-class>
  </listener>
  <listener>
    <listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
  </listener>
  <filter>  
          <filter-name>CharacterEncodingFilter</filter-name>  
          <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
          <init-param>  
              <param-name>encoding</param-name>  
              <param-value>UTF-8</param-value>  
  相关解决方案