File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Servlet Mapping not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet Mapping not working" Watch "Servlet Mapping not working" New topic

Servlet Mapping not working

Ron Ingram
Ranch Hand

Joined: Mar 11, 2011
Posts: 73
I need to use servlet mapping for the jsp form and I cannot get it working, nor can I figure out why. It is a requirement to use the form action tag exactly as-is



Servlet Name: stored in the edu.vt.cs5244 package
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63847

First of all, why are you using the package structure for the mapping? Bad idea and a possible security issue.

Secondly, your URL as specified in the form action does not match the mapping.

And finally, you should be prefixing the action URL with the web app's context path.

[Asking smart questions] [About Bear] [Books by Bear]
Ron Ingram
Ranch Hand

Joined: Mar 11, 2011
Posts: 73
Thanks. The form action is a requirement to use it exactly as-is.. so I cannot change it to a better practice.

The url in the web.xml mapping must begin with "/". When I match it exactly with the form action "servlet/edu.vt.cs5244.EnrollmentAdmin", netbeans throws an error as shown below:

Ron Ingram
Ranch Hand

Joined: Mar 11, 2011
Posts: 73
It appears my issue is not the mapping after all but an error in the servlet..

Thanks again..
I agree. Here's the link:
subject: Servlet Mapping not working
It's not a secret anymore!