aspose file tools
The moose likes Servlets and the fly likes Servlet Mapping not working Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply 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: 60
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: 56152
    
  13

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.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Ron Ingram
Ranch Hand

Joined: Mar 11, 2011
Posts: 60
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: 60
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://zeroturnaround.com/jrebel/download
 
subject: Servlet Mapping not working
 
Similar Threads
Cannot Invoke Servlets
Servlet and XML result HTTP 404
JSP not picking up getAttribute from Servlet
'The requested resource is not available' error
The requested resource is not available