Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Dec 3rd, 2005, 5:21 AM   #1
hemanth.balaji
Programmer
 
Join Date: May 2005
Posts: 54
Rep Power: 0 hemanth.balaji is an unknown quantity at this point
Send a message via Yahoo to hemanth.balaji Send a message via Skype™ to hemanth.balaji
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
hemanth.balaji is offline   Reply With Quote
Old Dec 3rd, 2005, 7:47 AM   #2
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Please use [code] tags - it's almost impossible to read like that.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Dec 3rd, 2005, 8:36 AM   #3
groovicus
Programmer
 
Join Date: Nov 2004
Posts: 84
Rep Power: 4 groovicus is on a distinguished road
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
groovicus is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 1:25 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC