tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Garret Wilson <>
Subject Re: valid XHTML 1.1, Tomcat, text/xml, and @!&* IE
Date Sat, 18 Sep 2004 17:31:13 GMT
Oh, this is just a nightmare.

Using JavaServer Faces, here are the options:

1. Just add a JSP directive:

< contentType="text/html"/>

Of course, that turns *all* pages into text/html, which we don't want to 
do for non-broken browsers such as Firefox and Mozilla.

2. Add a script to check for what the browser accepts:

< import="java.util.Enumeration"/>
   String contentType="text/html";
   final Enumeration httpAcceptEnumeration=request.getHeaders("accept");

   response.setContentType(contentType);	//set the content type to 
whatever we decided upon

That works really well; on Firefox it returns application/xhtml+xml, and 
for buggy browsers (and browsers that don't support XML at all, IE being 
the former) it returns text/html.

But do I want to put all of that junk in all of my JavaServer Faces 
files? I don't think so. Inclusion sounds perfect, but here's the 
problem: if I include the code statically, it doesn't get executed. If I 
include it dynamically, it doesn't correctly set the content-type header 
because its output is fed into the main page, which is working with the 
real HTTP request/response.

Anyone have an idea on this really nasty situation? Or should I just go 
back to sending out HTML 3.x?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message