• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Help on Servlets- web.xml not working

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"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
 
Bear Bibeault
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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



What's with the /jsp part of this URL?
 
Matthew Shepherd
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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



Should be in c:\tomcat 4.1\webapps\proj_name
 
Matthew Shepherd
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does C:\tomcat 4.1\webapps\proj_name have a WEB-INF directory in it?
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Everybody's invited. Even this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic