when u say its not running what is exactly happening.... u try using 127.0.0.1:8080 in place of localhost:8080 hope it'll run.... --- Purav <[EMAIL PROTECTED]> wrote: > Which version of tomcat are you using. I dun think > so you need a > super.init(config) call in the new servlet API. > > > -----Original Message----- > From: A mailing list for discussion about Sun > Microsystem's Java Servlet > API Technology. > [mailto:[EMAIL PROTECTED]] On Behalf Of > prshevde > Sent: Wednesday, December 19, 2001 8:21 PM > To: [EMAIL PROTECTED] > Subject: Problem in running a servlet on tomcat > Importance: High > > > > Dear all , > > I am trying to run following servlet using tomcat . > But am unable to do > so . Can any one 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> </td> > </tr> > <tr> > <td>age:</td> > <td><input align=left name=age size=2> </td> > </tr> > <tr> > <td>ssn:</td> > <td><input align=left name=ssn size=11> </td> > </tr> > <tr> > <td>dob:</td> > <td><input align=left name=dob size=8> </td> > </tr> > <tr> > <td>username:</td> > <td><input align=left name=username > size=8> </td> > </tr> > <tr> > <td>password:</td> > <td><input align=left name=password size=8 > type=password> </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
