External stylesheets not working in JSP page with the DOCTYPE defined

VERIFIED INVALID

Status

SeaMonkey
General
--
critical
VERIFIED INVALID
16 years ago
13 years ago

People

(Reporter: Balu Ramachandran, Assigned: asa)

Tracking

Trunk
x86
Windows 2000

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(6 attachments)

(Reporter)

Description

16 years ago
Build ID: 2002021303
I have a JSP page which is generated by multiple jsp files as included. The page
layout is created by an external style sheet (<link rel="stylesheet"
href="/sv/static/stylesheets/pubstyle.css" type="text/css" />). when i include
any  DOCTYPE for eg.
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

the styles from the external stylesheet is not applied. When I take the doctype
out it works fine. 

This problem occurs only in the Mozilla build. It works fine in Netscape 6.2 and
IE 6. Also this happens only for external stylesheets, not for inline styles.

This problem is NOT found when the page is plain HTML and the stylesheets are
external.
(Reporter)

Comment 1

16 years ago
Sorry the first line should read as "I have a JSP page which is generated by
multiple jsp files as includes."
That is because your page is being served as text/html or text/plain.  In order
to comply with the HTTP spec, all CSS _files_ *must* be served as text/css.  If
they are not, we do not parse them.  Note this is in _standards_ mode only. 
That explains why removing the doctype works, but the true solution is for you
to add this to the top of your JSP CSS page.

<%@ page contentType="text/css;charset=UTF-8" %>

(Note: I don't use JSP.  The above could be incorrect.  I just found it from a
quick google search for "http header jsp")

In any case, this is not our bug.  It is the problem of the content type header
you send us.  This is even in our release notes under developers issues. 
Marking invalid.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 16 years ago
Resolution: --- → INVALID
(Reporter)

Comment 3

16 years ago
The CSS page is not JSP. It .css type. So your answer won't solve the problem.
And why does it work when the whole page is HTML and not JSP? 
And when you add <%@ page contentType="text/css;charset=UTF-8" %>
to the page it becomes a CSS type and not HTML and Mozilla renders is the HTML code.
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
Please provide a URL then.  Also please make sure that your .css file is being
sent by the server as "text/css" -- if it is being sent as something else such
as "text/html" or "text/plain" then we will not parse it.
(Reporter)

Comment 5

16 years ago
Created attachment 70323 [details]
This is the main JSP file
(Reporter)

Comment 6

16 years ago
Created attachment 70324 [details]
THis is the header file
(Reporter)

Comment 7

16 years ago
Created attachment 70326 [details]
This another include
(Reporter)

Comment 8

16 years ago
Created attachment 70327 [details]
This is the style sheet
(Reporter)

Comment 9

16 years ago
I have included 4 importnat files. U can add balnk JSP pages for the others. 
Also this happens when I add a DOCTYPE which should trigger the quirks mode.

Reporter, the files most likely do _not_ matter.  It is what your Server sends
back as headers that matter.

In your shell, please set NSPR_LOG_MODULES to nsHttp:5 and 
set NSPR_LOG_FILE to some file name (such as c:\tmp\nsHttp.log)

set NSPR_LOG_MODULES=nsHttp:5
set NSPR_LOG_FILE=somefile.log

restart Mozilla (make sure you exit out of turbo if you are in it), visit the
JSP page in question, and shut down Mozilla.  then please attach the log file here.
(Reporter)

Comment 11

16 years ago
i am attaching 2 files. the first one is the webserver log file and the some
data from Mozilla's page info tab. The second one is the logfile of a proxy
which collects all the datatransfers from the server to the browser.
hope this helps

(Reporter)

Comment 12

16 years ago
Created attachment 70363 [details]
This is the mozilla tab info and the server logfile
(Reporter)

Comment 13

16 years ago
Created attachment 70364 [details]
Logfile for the proxy

This is just for the page in question
scan: Host: localhost
scan: User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.8+)
Gecko/20020218 default
scan: Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,text/css,*/*;q=0.1
scan: Accept-Language: en-us, fr;q=0.66, en;q=0.33
scan: Accept-Encoding: gzip, deflate, compress;q=0.9
scan: Accept-Charset: ISO-8859-1, utf-8;q=0.66, *;q=0.66
scan: Keep-Alive: 300
scan: Proxy-Connection: keep-alive crunch!
scan: Cookie: JSESSIONID=CNNCFLJKEGJA crunch!
scan: Referer: http://localhost/sv/publisher crunch!
scan: Pragma: no-cache
scan: Cache-Control: no-cache
GET /sv/static/stylesheets/pubstyle.css HTTP/1.1

scan: HTTP/1.1 200 OK
scan: Date: Tue, 19 Feb 2002 20:16:09 GMT
scan: Server: Orion/1.5.2
scan: Content-Length: 735
scan: Connection: Close crunch!
scan: Content-Type: application/octet-stream
HTTP/1.1 200 OK
                          ^^^^^^^^^^^^^
Your server is sending us the CSS file as application/octet-stream.

That is a problem with your server.  But this is _not_ a Mozilla bug.  You need
to get it to send text/css as the content type for css files like I mentioned
earlier.  I'm not sure how you do it with your server.  Read it's docs.

Again, marking this bug as INVALID.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 16 years ago16 years ago
Resolution: --- → INVALID
verified invalid. If the page is rendered in strict mode, stylesheets _must_
have the correct mimetype of text/css, otherwise they are ignored.
This is by design.
Status: RESOLVED → VERIFIED
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.