I am using Tomcat 3.1.1
exampl.java program is compiled by me . The .class file is copied to
webapps/examples/servlets directory.
I launched the servlet using internet explorer5.0 ,
http://localhost:8080/examples/servlet/example
I also tried  html example.html.
The message comes the page can not be displayed .
for yr. ready ref. I am giving the code below . This code is not written by
me , but copied from a book 'Developing Java Servlets' by James Goodwill. I
am in the process of learning servlets.
Please help!
Best Regards
Pramod.

> example.java
> import javax.servlet.*;
> import javax.servlet.http.*;
> import java.io.*;
> import java.util.*;
>
> public class example extends HttpServlet
> {
>      public void init(ServletConfig config)throws ServletException
         {
>   super.init(config);
>  }
>
>  public void doGet(HttpServletRequest
> req,HttpServletResponse res)throws
> ServletException,IOException
>  {
>   doPost(req,res);
>  }
>
>  public void doPost(HttpServletRequest
> req,HttpServletResponse
> res)throws ServletException,IOException
>  {
>   res.setContentType("text/html");
>   PrintWriter out=res.getWriter();
>   out.println("<html>");
>
> out.println("<head><title>example</title></head>");
>   out.println("<body>");
>   Enumeration parameters=req.getParameterNames();
>   String param=null;
>   while(parameters.hasMoreElements())
>   {
>    param=(String)parameters.nextElement();
>
>
out.println("<bold>"+param+":"+req.getParameter(param)+
>    "</bold><br>");
>   }
>   out.println("</body><html>");
>   out.close();
>  }
>  public String getServletInfo()
>  {
>   return "example information";
>  }
> }
>
> example.html
> <html>
> <head>
> <title>
> example retrieve
> </title>
> </head>
> <body>
> <form
>
action=http://localhost:8080/examples/servlet/example
> method=post>
> <table style="height:173px;width:242px">
> <tr>
>  <td>last name:</td>
>  <td><input name="last name" align="left"
> size="15"></td>
> </tr>
> <tr>
>  <td>first name:</td>
>  <td><input align="left" name="first name"
> size=15>&nbsp;</td>
> </tr>
> <tr>
>  <td>age:</td>
>  <td><input align=left name=age size=2>&nbsp;</td>
> </tr>
> <tr>
>  <td>ssn:</td>
>  <td><input align=left name=ssn size=11>&nbsp;</td>
> </tr>
> <tr>
>  <td>dob:</td>
>  <td><input align=left name=dob size=8>&nbsp;</td>
> </tr>
> <tr>
>  <td>username:</td>
>  <td><input align=left name=username
> size=8>&nbsp;</td>
> </tr>
> <tr>
>  <td>password:</td>
>  <td><input align=left name=password size=8
> type=password>&nbsp;</td>
> </tr>
> </table>
> <input type="submit" name="submit" value="submit">
> <input type="reset" value=reset>
> </form>
> </body>
> </html>
>
>
>


=====


__________________________________________________
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com

___________________________________________________________________________
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


----- Original Message -----
From: Christopher K. St. John <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, December 20, 2001 10:11 PM
Subject: Re: Problem in running a servlet on tomcat


> > Purav wrote:
> >
> > I dun think so you need a super.init(config) call in
> > the new servlet API.
> >
> >
> >  public void init(ServletConfig config)
> >    throws ServletException
> >       {
> >        super.init(config);
> >       }
> >
>
>  The super.init(config) call is definitely required
> in this case.
>
>  HttpServlet defines two "init" methods:
>
>    HttpServlet.init()
>    HttpServlet.init(ServletConfig config)
>
>  You can override either one of them. If you
> override the one with no arguments, the HttpServlet
> saves the config argument for you. If you override
> the one that takes a ServletConfig argument, then
> you are responsible for calling super.init(config).
>
>  This all sounds a lot more complicated than it
> really is, take a look at the source code if
> you're curious.
>
>
> --
> Christopher St. John [EMAIL PROTECTED]
> DistribuTopia http://www.distributopia.com
>
>
___________________________________________________________________________
> 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
>

___________________________________________________________________________
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