File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet Mapping not working" Watch "Servlet Mapping not working" New topic
Author

Servlet Mapping not working

Ron Ingram
Ranch Hand

Joined: Mar 11, 2011
Posts: 63
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

JSP



web.xml



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

Joined: Jan 10, 2002
Posts: 60752
    
  65

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] [Bear's FrontMan] [About Bear] [Books by Bear]
Ron Ingram
Ranch Hand

Joined: Mar 11, 2011
Posts: 63
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: 63
It appears my issue is not the mapping after all but an error in the servlet..

Thanks again..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet Mapping not working
 
Similar Threads
The requested resource is not available
'The requested resource is not available' error
Cannot Invoke Servlets
JSP not picking up getAttribute from Servlet
Servlet and XML result HTTP 404