You forget to do
res.setContentType("text/html");

Also you must understand that servlet is running on server side. Not on
client side. So it does not matter what type of browser you have. Browser
does not see you <SERVLET> tag.

Such behavior is just because when content type is not set IE by default
thinks it's HTML. Netscape thinks it's plain text and shows it as plain
text.

George.

> -----Original Message-----
> From: Antonio Villafana [SMTP:[EMAIL PROTECTED]]
> Sent: Wednesday, November 10, 1999 10:20 AM
> To:   [EMAIL PROTECTED]
> Subject:      Simple .shtml test
>
> Hello everyone,
> Here's my problem.... Can someone tell me why this <servlet> tag works in
> IE and not Netscape. The 'ssiexample.shtml' example that came with
> ServletExec works fine in both IE and Netscape. The 'login' servlet is
> registered in ServletExec admin. Therefore I do not need the 'code' or
> 'codebase' in the <servlet> tag.
> When 'test.shtml' is opened in Netscape, it just displays the HTML codes
> on the page. INCLUDING the response generated by the 'login' servlet.
>
> Here is the 'test.shtml' snippet:
> <HTML><HEAD><title>TEST PAGE</title></HEAD>
> <p>my .shtml test</p>
> <BODY> <SERVLET NAME="login"> </SERVLET></BODY></HTML>
>
> Here is the 'login' snippet:
> try {
>     String name = null;
>     con = DriverManager.getConnection("jdbc:oracle:thin:@mail:1521:ora",
> "vahps", "manager");
>     stmt = con.createStatement();
>     rs = stmt.executeQuery ("select username from user_pass where
> userclass = 'test'");
>     out.println("<FORM>");
>     out.println("<SELECT NAME=selname>");
>     out.println("<OPTION SELECTED VALUE=0> --Choose a Name--");
>     int i = 1;
>     while (rs.next()) {
>       name = (rs.getString("username"));
>       out.println("<OPTION VALUE=" + name + ">" + name);
>     }
>     out.println("</SELECT></FORM>");
>  }
>     catch (SQLException e) {
>      out.println("SQLException caught: " + e.getMessage());
>      }
>      catch (Exception e) {
>      out.println("<HTML><HEAD><TITLE>Connection Failure</TITLE></HEAD>");
>      out.println("<BODY>Cannot connect to db.Bad connection script<BR>");
>      out.println(e.getMessage() + "<BR>");
>      out.println("</BODY></HTML>");
>      }
>
> Here is what get displayed in Netscape:
> <HTML><HEAD><title>TEST PAGE</title></HEAD>
> <p>my .shtml test</p>
> <BODY>
> <FORM>
> <SELECT NAME=m1>
> <OPTION SELECTED VALUE=0> --Choose a Name--
> <OPTION VALUE=ray>ray
> <OPTION VALUE=birnie>birnie
> </SELECT></FORM>
> </BODY></HTML>
>
> Antonio A. Villafana
> Systems Analyst
> Parikh Advanced Systems
> (804) 559-1035

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to