MIME类型text / html
您好我正在一个项目,并尝试添加CSS到页面,但它不加载,当我检查在浏览器srourcecode我得到一个:
将资源解释为样式表,但使用MIME类型text / html传输:
我尝试以各种方式加载css,使用 - “rel =”stylesheet“> - - 即使使用@import文件(不是最佳做法,但我尝试过......)
它不工作。
文件:项目:
-网页内容
-resources
- css
-main.css
-WEB-INF-
-MTEA-INF
web.xml中:
<?xml version="1.0" encoding="UTF-8"?>
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd“version =”3.1“>
<!-- The front controller of this Spring Web application, responsible for
handling all application requests -->
<servlet>
<servlet-name>springapp</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>WEB-INF/springapp-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Map all requests to the DispatcherServlet for handling -->
<servlet-mapping>
<servlet-name>springapp</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
调度员servlet.xml中:
<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.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">
<context:component-scan base-package="com.drs.controller" />
<mvc:annotation-driven />
<mvc:resources mapping="/resources/**" location="resources/" />
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView"></property>
<property name="prefix" value="/WEB-INF/jsp/"></property>
<property name="suffix" value=".jsp"></property>
</bean>
任何人都有一个ideea?如何解决这个问题?
链接地址: http://www.djcxy.com/p/47017.html上一篇: MIME type text/html
下一篇: Stylesheet is sent with a wrong mime type using node.js, how do I fix that?