![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
|
Probelm with program execution in TOMCAT
I am using Tomcat and I am facing the folowing probelm with this simple code to display the parameters entered on a html page by invoking a servlet...
------------------------------------------------------------------------------------------------ My file name(html) is ThreeParamsForm.html which contains (PLaced in my web application folder) ------------------------------------------------------------------------------------------------ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE>Collecting Three Parameters</TITLE> </HEAD> <BODY BGCOLOR="#FDF5E6"> <H1 ALIGN="CENTER">Collecting Three Parameters</H1> <FORM ACTION= "ThreeParams" method = get> First Parameter: <INPUT TYPE="TEXT" NAME="param1"><BR> Second Parameter: <INPUT TYPE="TEXT" NAME="param2"><BR> Third Parameter: <INPUT TYPE="TEXT" NAME="param3"><BR> <CENTER> <INPUT TYPE="SUBMIT"> </CENTER> </FORM> </BODY> </HTML> ---------------------------------------------------------------------------------------- My second file(servlet) name is ThreeParams.java which contains (PLaced in web-inf/src) ----------------------------------------------------------------------------------------- package coreservlets; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; /** Simple servlet that reads three parameters from the * form data. */ public class ThreeParams extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); String title = "Reading Three Request Parameters"; //ServletUtilities.headWithTitle(title) + out.println( "<BODY BGCOLOR=\"#FDF5E6\">\n" + "<H1 ALIGN=CENTER>" + title + "</H1>\n" + "<UL>\n" + " <LI><B>param1</B>: " + request.getParameter("param1") + "\n" + " <LI><B>param2</B>: " + request.getParameter("param2") + "\n" + " <LI><B>param3</B>: " + request.getParameter("param3") + "\n" + "</UL>\n" + "</BODY></HTML>"); } } ------------------------------------------------------------ and my web.xml contains the following entry for this file ------------------------------------------------------------ <servlet> <servlet-name>HelloServlet3</servlet-name> <servlet-class>coreservlets.HelloServlet3</servlet-class> </servlet> <servlet-mapping> <servlet-name>ThreeParams</servlet-name> <url-pattern>/ThreeParams</url-pattern> </servlet-mapping> -------------------------------------------------- When I run using TOMCAT I get the follwing error -------------------------------------------------- HTTP Status 404 - /servlet/coreservlets.ThreeParams type Status report message /servlet/coreservlets.ThreeParams description The requested resource (/servlet/coreservlets.ThreeParams) is not available. Apache Tomcat/5.0.25 ---------------------- How do i make it work ---------------------- Regards. Hemanth [ http://javahome1.tripod.com/javahome.htm ] hemanth.balaji@gmail.com |
|
|
|
|
|
#2 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Please use [code] tags - it's almost impossible to read like that.
|
|
|
|
|
|
#3 |
|
Programmer
Join Date: Nov 2004
Posts: 84
Rep Power: 4
![]() |
You might not have the file correctly mapped. It is hard to say though since you have half of the mapping for HelloServlet3, and half the mapping for ThreeParams shown. What does the rest of it look like?
I can't tell if there is anything else wrong because the rest of it borders on unreadable... ![]()
__________________
HijackThis Team-SFDC |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|