Thanks for all the replies. I did solve the mystery. IE is indeed a POS.
It looks like it completely ignores the Content-Type headers and it just scans the beginning of the file.
The JSPs I was struggling with are using lots of JSP directives (tag lib and page), includes and tiles. The result was that there were many empty lines after the DOCTYPE declaration and the <html> tag. IE seems to be scanning for the <html> tag (don't ask why) and if it does not find it soon enough then it gives up and treats the file as raw XML. Pretty smart.
I attached a test file which on my system is treated as raw XML. If I delete on single empty line before the <html> tag then it is treated as XHTML.
Now this is sort of a show stopper for me, unless I find a way to reduce the empty lines a the top of a file. Is there a way in Tomcat to prevent the creation of an empty line for each JSP directive? I cannot move the <html> tag on top since it is generated in a layout file and imported through tiles.
A few more observation regarding IE. It seems that one it guessed the type of a page it is caching that info in memory. Deleting temporary files and forcing a check on every visit does not help. You have to close the browser in order to flush this cache. Loading pages from the file system has a completely different logic, it is based on the file extension (there is no scanning for <html> tag).
Thanks again, Marius
Carlos Pereira wrote:
That's because IE ignores the Content-Type header and just looks at the first few bytes of the file to decide how to display it. What a POS. Anyway...
(Christopher Schultz)
IE works like this: in the first call to a web page, it checks the Content-Type and displays the web page accordingly. Next time you request the same page, it ignores the Content-Type.
I know that this issue came up before on this list, but the solution suggested previously (adding a page directive with the content type) does not work.
(Marius Scurtescu)
So, do the following: 1. You have to make sure IE is foing to display the most recent page. You can do this by either adding a pragma/no-cache header, or go to (in IE): tools/internet options/temporary internet files/settings and, under "check for newer versions of stored pages", select the "every visit to the page" option. When you are developing, this last thing should ALWAYS be done. Otherwise, you might be getting IE cached versions of the web page and asking yourself why the changes aren't working. 2. Force IE to read the Content-Type again. Simply shut down the browser, and request your xhtml page to see if it works.
Hope that helps. Carlos Pereira
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]