tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yansheng Lin" <>
Subject RE: Content type for jsp/html files
Date Tue, 24 Feb 2004 22:15:04 GMT
Totally!  With context type set to text/plain is not going to provent IE doing
something on its own.

The sure fix is to replace all the "<" with "&lt;".

-----Original Message-----
From: Antonio Fiol BonnĂ­n [] 
Sent: Tuesday, February 24, 2004 12:41 PM
To: Tomcat Users List
Subject: Re: Content type for jsp/html files

Johan Wallinder wrote:

>I've want to make a servlet that can display the source of any jsp/html
>file (not the rendered one). 
>Basically my code is like this:
>*set content type to text/plain
>*get PrintWriter object out
>*get the fileobject as an inputstream 
>*write to the out object
>The code is working fine, but viewing the servlet execution in a
>browser, the content type is set to text/html which means that all tags
>are not displayed (hidden).
>How can I override this behavior. If I read a text file everything works
>fine. But if the file begins with an <html> tag, the contenttype is set
>to text/html. Is this a browser problem? 

I'm afraid Internet Explorer is willing to play with you. ;-)

Try adding "nonsense.txt" to your URL, as in:


IE has a horrible MIME behaviour. Live with it, or trash IE ;-)

Antonio Fiol

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

View raw message