0

Hi I'm working on a project and try to add css to a page but its not loading and when i check srourcecode at the browser I get a :

Resource interpreted as Stylesheet but transferred with MIME type text/html:

I tried to load css in every way, with - " rel="stylesheet"> - - even with @import file ( not a best practice but i tried...)

and its not working.

Files: Project:

-WebContent

   -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>

dispatcher-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>

Anyone have an ideea?How to solve this?

2
  • If the problem was with your server, then it means that the issue is not with the code you presented here which means that the question as shown here in not reproducible. This likely doesn't have any value for future readers. The best thing to do would be to delete the question instead of "answering" it with an unuseful answer.
    – Artjom B.
    Nov 6, 2015 at 2:06
  • yah if none of you couldn't provide any answer or atleast try...i will delete it dont worry.
    – Drastaro
    Nov 6, 2015 at 7:21

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.