• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Servlet Mapping not working

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 67746
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
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.
 
Ron Ingram
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It appears my issue is not the mapping after all but an error in the servlet..

Thanks again..
 
reply
    Bookmark Topic Watch Topic
  • New Topic