You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Alessandro Panzeri <al...@gmail.com> on 2014/11/06 12:04:52 UTC

jsp page on Tomcat non loading css

I deployed a war on Tomcat 7 to serve a jsp page.

In the jsp page I put this css tag:

<link href="../css/new_style.css" rel="stylesheet" type="text/css"/>

Also, at the beginning of the jsp page I put this:

<%@ page contentType="text/html;charset=utf-8" %>

However when I contact via browser such jsp page, the css is NOT loaded and
I found that the reason is (returned by Google Chrome inspecting the page):

"Resource interpreted as Stylesheet but transferred with MIME type
text/plain."

I can't figure out what to modify...any advice?

Re: jsp page on Tomcat non loading css

Posted by "Terence M. Bandoian" <te...@tmbsw.com>.
On 11/7/2014 7:55 PM, Daniel Baktiar wrote:
> Hi Alessandro,
>
> Is there any servlet filter running which modifies the "Content-Type"
> headers?
> Look at the web.xml for <filter/> tag.
>
> Daniel Baktiar
>
> On Thu, Nov 6, 2014 at 7:04 PM, Alessandro Panzeri <
> alessandro.panzeri88@gmail.com> wrote:
>
>> I deployed a war on Tomcat 7 to serve a jsp page.
>>
>> In the jsp page I put this css tag:
>>
>> <link href="../css/new_style.css" rel="stylesheet" type="text/css"/>
>>
>> Also, at the beginning of the jsp page I put this:
>>
>> <%@ page contentType="text/html;charset=utf-8" %>
>>
>> However when I contact via browser such jsp page, the css is NOT loaded and
>> I found that the reason is (returned by Google Chrome inspecting the page):
>>
>> "Resource interpreted as Stylesheet but transferred with MIME type
>> text/plain."
>>
>> I can't figure out what to modify...any advice?


Hi, Alessandro-

Something doesn't seem right to me.

What is the URL you use to access the JSP page?
What is the path name of your application directory?
What is the path name of the CSS directory?

-Terence Bandoian


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: jsp page on Tomcat non loading css

Posted by Daniel Baktiar <db...@gmail.com>.
Hi Alessandro,

Is there any servlet filter running which modifies the "Content-Type"
headers?
Look at the web.xml for <filter/> tag.

Daniel Baktiar

On Thu, Nov 6, 2014 at 7:04 PM, Alessandro Panzeri <
alessandro.panzeri88@gmail.com> wrote:

> I deployed a war on Tomcat 7 to serve a jsp page.
>
> In the jsp page I put this css tag:
>
> <link href="../css/new_style.css" rel="stylesheet" type="text/css"/>
>
> Also, at the beginning of the jsp page I put this:
>
> <%@ page contentType="text/html;charset=utf-8" %>
>
> However when I contact via browser such jsp page, the css is NOT loaded and
> I found that the reason is (returned by Google Chrome inspecting the page):
>
> "Resource interpreted as Stylesheet but transferred with MIME type
> text/plain."
>
> I can't figure out what to modify...any advice?
>

Re: jsp page on Tomcat non loading css

Posted by Konstantin Kolinko <kn...@gmail.com>.
2014-11-06 14:04 GMT+03:00 Alessandro Panzeri <al...@gmail.com>:
> I deployed a war on Tomcat 7 to serve a jsp page.
>
> In the jsp page I put this css tag:
>
> <link href="../css/new_style.css" rel="stylesheet" type="text/css"/>
>
> Also, at the beginning of the jsp page I put this:
>
> <%@ page contentType="text/html;charset=utf-8" %>
>
> However when I contact via browser such jsp page, the css is NOT loaded and
> I found that the reason is (returned by Google Chrome inspecting the page):
>
> "Resource interpreted as Stylesheet but transferred with MIME type
> text/plain."
>
> I can't figure out what to modify...any advice?

It means that server accompanies your CSS file with HTTP protocol
header "Content-Type: text/plain" while the browser expects it to be
"Content-Type: text/css".

The contents of your JSP page and your <link> tag are irrelevant. You
cannot solve this by modifying your JSP or CSS files.

The mime type for static files is usually configured by <mime-mapping>
elements in your web.xml.  Either you have those wrong, or your CSS is
not a static file, or something else modifies your Content-Type header
(e.g. a Filter).

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: jsp page on Tomcat non loading css

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Alessandro,

On 11/6/14 6:04 AM, Alessandro Panzeri wrote:
> I deployed a war on Tomcat 7 to serve a jsp page.
> 
> In the jsp page I put this css tag:
> 
> <link href="../css/new_style.css" rel="stylesheet"
> type="text/css"/>
> 
> Also, at the beginning of the jsp page I put this:
> 
> <%@ page contentType="text/html;charset=utf-8" %>
> 
> However when I contact via browser such jsp page, the css is NOT
> loaded and I found that the reason is (returned by Google Chrome
> inspecting the page):
> 
> "Resource interpreted as Stylesheet but transferred with MIME type 
> text/plain."
> 
> I can't figure out what to modify...any advice?

Use a tool that will show you the HTTP response headers that you get
when you request "..../css/new_style.css" from your server.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJUXRvOAAoJEBzwKT+lPKRYTbMP/0zHnepsHXOACiqh8CrU6rlU
vSTifaNYZx+pQ9b0Dt05pTpAZyPBBVZM7T4eeI1OD/by2mzExGCAQ85e53pXcPng
S93K24B0XYX/qRFHAfkKClpodxcxczFSyV8H93QRyGw1uiUA11utshXAGPiDHsga
ItbLuKVha5RMfTpLUTErwOaPwrMBQ8VVqiaeaC8rinWRBJa69eDQd6EuY69g+U07
MrxJhRMCYzwcrrT5jMWKoVcEvZ3jV8q8u0Uunm6BTEwqM21oJ7HNI/02btR2pOKl
7Sg9WEn3tqkeqR6vTzfgSk1hdyOmc6b+CzRFw1g6HemYPESw4RtC3OcpPiAgY3Sl
mobZ54mA7v5Uqq58h9uV8/hxC6S7lqTyUXQhTSvXTk3AdEdx/gD4X24RtegDDaqi
zV1G0uR1DpmYtjQojdwbVCyF1lvF4DyV6fasm9ueApIuecgC0JbI9feCIqrxzXdf
+MqwC1+08KOZ5Hb+Fs/VqERAUPWZGIM2VPp0C30HpyW+3IyWifQh/E789a2xofKf
F/9RK4uZvUZWibF8LasVZveT+AoGcDyH6V5GRlZghbdIJ7018ZR6+5TlsjCStNef
IKthykDwZfGAVKruw1+MjdMNDQiDJoQTEWbdklslt9oLmh/YZtJL40sZpqK3EaHu
zwhDW4QL1cSjlDVqckiE
=U774
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org