Click to See Complete Forum and Search --> : Nescape doesn't understand HTML


Albatross
December 14th, 2002, 08:45 AM
Is this the right place for this question?
I am using Netscape 7.0 and IE 6.0 to read my servlets running in an Apache-Tomcat
server on my intranet.

when I call the server http://server1/myApp/servlet/S1 from another PC on the intranet,
The SimpServlet (named S1) sends out :

<HTML>
<HEAD>
<TITLE>Simple Servlet</TITLE>
</HEAD>
<BODY>
Hello I am the Simple Servlet
</BODY>
</HTML>

and IE interprets this as HTML and you see : "Hello I am the Simple Servlet":)

but Netscape thinks it is a text file and you see :
<HTML>
<HEAD>
<TITLE>Simple Servlet</TITLE>
</HEAD>
<BODY>
Hello I am the Simple Servlet
</BODY>
</HTML> :confused:

How must I tweak Netscape to understand this as HTML code?

Zvona
December 15th, 2002, 01:35 PM
First thing comes into my mind: Server is sending your file as text/plain instead of text/html. This causes improper rendering in Netscape.

Albatross
December 16th, 2002, 08:07 AM
Excellent, it was in the servlet a line which Netscape needs :

response.setContentType("type/html");

many thanks; :D

Zvona
December 16th, 2002, 01:19 PM
Originally posted by Albatross
Excellent, it was in the servlet a line which Netscape needs :

response.setContentType("type/html");

many thanks; :D

No problem, but I think it should be text/html ;).

websmith99
December 18th, 2002, 03:15 PM
IE 6 overrode the content type that had been sent by the server (text/plain) and interpreted it as text/html after parsing the content and seeing the HTML tags. Netscape 7 strictly followed the content type sent by the server and interpreted it as text/plain.

Setting the content type in the servlet is the correct thing to do.

If, however, you wish to change the content type sent by the server to default to text/html rather than text/plain, then modify the config file for your Apache server.

TheCPUWizard
December 18th, 2002, 03:37 PM
Is anyone willing to suggest that the title should have been...

:eek: " IE does not follow HTML Spec??" :eek:

websmith99
December 18th, 2002, 03:46 PM
In general, IE does not follow the mime type sent by the server, but will "intelligently" determine which content type a given file is
after analyzing the content.

Sometimes this will work to your advantage, and other times it will cause much frustration!