Forums Register Login

Help on Servlets- web.xml not working

+Pie Number of slices to send: Send
First of all i'm new to servlets and this forum.
Tomcat Home c:\tomcat 4.1\
I'm trying to call a servlet from a jsp page
My Jsp is in the c:\tomcat 4.1\ proj_name\jsp\
and has .....
<form method="POST" action="selectservlet.do">


My Web.xml has
<web-app>
<servlet>
<servlet-name>EntryPoint</servlet-name>
<servlet-class>testservlet.myservlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>EntryPoint</servlet-name>
<url-pattern>/*.do</url-pattern>
</servlet-mapping>
</web-app>


And My Servlet is at

c:\tomcat 4.1\
proj_name\WEB-INF\classes\testservlet\
myservlet.class

----------------------------
Code in Servlet
package proj_name;

Error I'm getting is

description: The requested resource (/proj_name/jsp/selectservlet.do) is not available.



I moved the Jsp to the c:\tomcat 4.1\ proj_name\
Error is the same: The requested resource (/proj_name/selectservlet.do) is not available.

Can some one help me.
+Pie Number of slices to send: Send
"shepherd shepherd",

There aren't may rules that have been put into place here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
Forum Bartender
+Pie Number of slices to send: Send
 

The requested resource (/proj_name/jsp/selectservlet.do) is not available.



What's with the /jsp part of this URL?
+Pie Number of slices to send: Send
Sorry about the confusion on user Id
----------
"/jsp " in URL

(/proj_name/jsp/selectservlet.do)
My tomcat home ( C:\tomcat 4.1))
has the folder named proj_name\jsp\

where i have my jsp - from where i Post the *.do


<html>
<head><title>JSP Page</title></head>
<body>
<form method="POST" action="selectservlet.do">
<center>Enter Name</center>
<center><input type="text" name="new_name"></center>
</br>
<center>Search Options : Uncheck the following for exact name search </center>
</br>
<center>Name Containing</center>
<center><input type="checkbox" name="exactname"></center>
<center>Names Beginning With</center>
<center><input type="checkbox" name="beginname"></center>
<br>
<center><input type="Submit" name="Get" value="Get Comments"></center>
</form>
</body>
</html>



This inturn (ideally) must check my servlet mapping and invoke the servlet

Error I'm getting is

description: The requested resource (/proj_name/jsp/selectservlet.do) is not available.



Then I tried moving the Jsp out of the folder to
C:\tomcat 4.1\proj_name\
Error I'm getting is

description: The requested resource (/proj_name/selectservlet.do) is not available.
+Pie Number of slices to send: Send
 

My Jsp is in the c:\tomcat 4.1\ proj_name\jsp



Should be in c:\tomcat 4.1\webapps\proj_name
+Pie Number of slices to send: Send
Ben
----------------------
( Actually I tried both in JSP folder and in c:\tomcat 4.1\webapps\proj_name )
----------------------


I tried the JSP from
c:\tomcat 4.1\webapps\proj_name

Error I'm getting is

description: The requested resource (/proj_name/selectservlet.do) is not available.

My servlet (class file) is at
C:\Tomcat 4.1\webapps\proj_name\WEB-INF\classes\testservlet



package testservlet;
/** Package - set webapps/root/class/testservlet */
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.sql.*;
import java.util.*;

public class myservlet extends HttpServlet {
..
..
..


Thanks For your help
+Pie Number of slices to send: Send
Where your JSP resides is completely moot with regards to servlet URLs that it will post to.

The point of my first post is that you should not be putting the /jsp part in your servlet URLs.
+Pie Number of slices to send: Send
 

Originally posted by Bear Bibeault:
Where your JSP resides is completely moot with regards to servlet URLs that it will post to.

The point of my first post is that you should not be putting the /jsp part in your servlet URLs.



Agreed.
My point was that, unless you've got a valid webapp to begin with, all other points are moot.

Can you run a hello, world JSP?
+Pie Number of slices to send: Send
Yes I could work on normal JSPs and could see the results
I think web.xml is not being recognised

The POST on my JSP is returning this message i guess.
In my common/lib i have 28 jars including servlet.jar
anythin missing here?

I tried running JSP from different folders within C:\tomcat 4.1\webapps\proj_name
gets me ths same error (differnt path mentioned)
+Pie Number of slices to send: Send
Does C:\tomcat 4.1\webapps\proj_name have a WEB-INF directory in it?
+Pie Number of slices to send: Send
To make sure:
1 you have form bean, action servlet and JSP?!
2 make sure your have all of struts dev JAR?!
3 could you copy the struts dev JAR to your TOMCAT %globalHome% or in your %Project Home%

if every thing is OK>>>change your action as follow:
In your struts-config.xml,

action mapping path=xxx.do(un-change)

change:

action mapping path=xxx

if Error also
pls Post your exception
OK?

[ June 03, 2005: Message edited by: Yu Tao ]
[ June 03, 2005: Message edited by: Yu Tao ]
Oh, sure, you could do that. Or you could eat some pie. While reading this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1299 times.
Similar Threads
Unable to run external JSP sample files in Tomcat/Win95
Resource not available
How can I get my HelloWorld Servlet to Run?
Problem with Apache Tomcat 5.5.12 and calling Servlets
new to tomcat
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 05:24:34.