wood burning stoves 2.0*
The moose likes Servlets and the fly likes figuring out servlets? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "figuring out servlets?" Watch "figuring out servlets?" New topic
Author

figuring out servlets?

Tom Boyce
Greenhorn

Joined: Jul 03, 2003
Posts: 24
I constantly have problems pointing to a servlet from a jsp, so I know I'm missing something fundamental. Can someone help me understand? Here is my directory structure:
webapps
FamilyViolence
WebApplication1
build
generated
web
images
jsp
Shelter_CheckIn.jsp
META-INF
WEB-INF
classes
FamilyViolence
bus
ValidateChildren.class
src
FamilyViolence
ValidateChildren.java

I want to go from my Shelter_CheckIn.jsp to the ValidateChildren.Class

Here is my web.xml

<servlet-name>ValidateChildren</servlet-name>
<servlet-class>FamilyViolence.bus.ValidateChildren</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ValidateChildren</servlet-name>
<url-pattern>/servlet/ValidateChildren</url-pattern>
</servlet-mapping>

And finally, how I'm attempting to get there in my jsp

<form name="intake" action="/ValidateChildren">

If anyone can help me not only fix the problem, but understand I would be greatly appreciative!

Thanks!
Sheldon Fernandes
Ranch Hand

Joined: Aug 18, 2004
Posts: 157
Match the form's action to the servlet's URL pattern.
<form name="intake" action="/servlet/ValidateChildren">

In order to invoke your servlet, the URL used must match the </url-pattern> defined in the </servlet-mapping>. All requests matching the URL pattern provided will be sent to the servlet.

Sheldon
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: figuring out servlets?
 
Similar Threads
javax.naming.NamingException: Could not dereference object
Problems using displaytag + faces: + webflow: servlet conflict
Struts with Resin
Help on Servlets- web.xml not working
Servlet to servlet