You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Saurabh Shukla <sa...@cysphere.com> on 2000/12/19 21:50:41 UTC

RE: Netscape displaying the HTML code

You can refer "ForceType" directive in Apache.

Shuklix

-----Original Message-----
From: Guntupalli Shanti [mailto:sguntupa@cisco.com]
Sent: Wednesday, December 20, 2000 2:46 AM
To: tomcat-user@jakarta.apache.org
Subject: Netscape displaying the HTML code


Hi,

I have tomcat 3.2 running on Apache 1.3.14.
All the HTML content in my web site is returned by the servlets based on 
the templates passed
in the query. Something like

http://www.myserver.com:8070/examples/servlet/servletname?page=main

where main is a html template file.
When I am accessing the page from IE I get exactly what I want
but when I access this in netscape it displays all the HTML code.
Does any one know how to fix it?

Thanks in advance
Shanti



Re: Netscape displaying the HTML code

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.

Guntupalli Shanti wrote:

> Thanks for the reply but I don't think that works.
> 2 reasons why:
>
> 1) As far as I understand when the request comes in for servlet it is
> passed to tomcat
> and from there onwards tomcat does the rest of the processing.
>
> 2) Also even if I use the ForceType directive it defaults all the files in
> that directory (which in my case are all servlets) to html
> which is not right.
>
> All I am doing in the servlet is to read the html template into a string,
> replace some variables and use the
> out.println(String) statement to send it back to the browser.
>
> Am I missing something ??
>

Are you calling

    response.setContentType("text/html");

before you call getWriter()?  If you don't, the server's default content type
will be assumed -- often "text/plain" -- which would cause the raw HTML code to
be displayed.

>
> Shanti
>

Craig McClanahan


>
> At 02:20 AM 12/20/2000 +0530, you wrote:
>
> >You can refer "ForceType" directive in Apache.
> >
> >Shuklix
> >
> >-----Original Message-----
> >From: Guntupalli Shanti [mailto:sguntupa@cisco.com]
> >Sent: Wednesday, December 20, 2000 2:46 AM
> >To: tomcat-user@jakarta.apache.org
> >Subject: Netscape displaying the HTML code
> >
> >
> >Hi,
> >
> >I have tomcat 3.2 running on Apache 1.3.14.
> >All the HTML content in my web site is returned by the servlets based on
> >the templates passed
> >in the query. Something like
> >
> >http://www.myserver.com:8070/examples/servlet/servletname?page=main
> >
> >where main is a html template file.
> >When I am accessing the page from IE I get exactly what I want
> >but when I access this in netscape it displays all the HTML code.
> >Does any one know how to fix it?
> >
> >Thanks in advance
> >Shanti

RE: Netscape displaying the HTML code

Posted by Guntupalli Shanti <sg...@cisco.com>.
Thanks for the reply but I don't think that works.
2 reasons why:

1) As far as I understand when the request comes in for servlet it is 
passed to tomcat
and from there onwards tomcat does the rest of the processing.

2) Also even if I use the ForceType directive it defaults all the files in 
that directory (which in my case are all servlets) to html
which is not right.

All I am doing in the servlet is to read the html template into a string, 
replace some variables and use the
out.println(String) statement to send it back to the browser.

Am I missing something ??

Shanti

At 02:20 AM 12/20/2000 +0530, you wrote:

>You can refer "ForceType" directive in Apache.
>
>Shuklix
>
>-----Original Message-----
>From: Guntupalli Shanti [mailto:sguntupa@cisco.com]
>Sent: Wednesday, December 20, 2000 2:46 AM
>To: tomcat-user@jakarta.apache.org
>Subject: Netscape displaying the HTML code
>
>
>Hi,
>
>I have tomcat 3.2 running on Apache 1.3.14.
>All the HTML content in my web site is returned by the servlets based on
>the templates passed
>in the query. Something like
>
>http://www.myserver.com:8070/examples/servlet/servletname?page=main
>
>where main is a html template file.
>When I am accessing the page from IE I get exactly what I want
>but when I access this in netscape it displays all the HTML code.
>Does any one know how to fix it?
>
>Thanks in advance
>Shanti