| Author |
Help on Servlets- web.xml not working
|
Matthew Shepherd
Greenhorn
Joined: Jun 02, 2005
Posts: 4
|
|
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.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56221
|
|
"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
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56221
|
|
The requested resource (/proj_name/jsp/selectservlet.do) is not available.
What's with the /jsp part of this URL?
|
 |
Matthew Shepherd
Greenhorn
Joined: Jun 02, 2005
Posts: 4
|
|
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.
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
My Jsp is in the c:\tomcat 4.1\ proj_name\jsp
Should be in c:\tomcat 4.1\webapps\proj_name
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
Matthew Shepherd
Greenhorn
Joined: Jun 02, 2005
Posts: 4
|
|
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
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56221
|
|
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.
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
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?
|
 |
Matthew Shepherd
Greenhorn
Joined: Jun 02, 2005
Posts: 4
|
|
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)
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
|
Does C:\tomcat 4.1\webapps\proj_name have a WEB-INF directory in it?
|
 |
Yu Tao
Greenhorn
Joined: Dec 12, 2004
Posts: 28
|
|
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 ]
|
 |
 |
|
|
subject: Help on Servlets- web.xml not working
|
|
|