• Post Reply Bookmark Topic Watch Topic
  • New Topic

Servlets and browsers  RSS feed

 
Sandeep Deshmukh
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

I have written a servlet for login purpose which works fine in IE.
But in Mozilla the same servlet though not throwing any exception is showing the html code in output instead of my login form.

More Info:
I am using content type as text/html.
My tomcat is of version 3.2 on a unix server.

What could be the problem here?

Help me solve the problem.

Sandeep
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Post the code where you're setting the content-type.
 
Mike Nightsky
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe you overwrite the contenttyp at a later codeline.
 
Sandeep Deshmukh
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys

Unfortunately i dont have access to the servlet code but was told that content type is set in the servlet as text/html. Our company has built a customised servlet that works like CGI. Hence there is common servlet for view rendering. Views are made in html templates.

Login has a normal login html template page and actually I havent specified the content type in html template. It is set by servlet.

Following lines get appended from servlet to the begining of html output:

Date: Wed, 12 Jan 2005 10:41:29 GMT
Server: Apache/1.3.12 (Unix) mod_jk
Content-Type: text/html
Connection: close

Above lines are appended to output view by servlet for all the pages internally.

Surprisingly the same login code as sent by the servlet is working, if i save the code on local disk as html file and then access the html through mozilla.

Sandeep
 
Sandeep Deshmukh
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys

I would like to add that my local servlet for testing purpose has following code:

public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
response.setContentType("text/html");

PrintWriter out = response.getWriter();
out.println(..........
}

Sandeep
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The easiest way to answer the question is to look at the headers yourself. You can do this with either a packet sniffer like Ethereal or, just install Mozilla/Firefox and install the LiveHeaders plugin.
http://livehttpheaders.mozdev.org/

You'll see exactly what content-type is being sent.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!