Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

servlet mapping not working as expected

 
shivang sarawagi
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

My servlet mapping in web.xml is not working fine. I have double checked but not sure what is the issue.
Can anyone please help.

Here is my servlet mapping




from login.jsp which is under webContent/jsp/login.jsp



I am submitting the form. But on clicking submit I don't know why the flow is going to this path

"http://localhost:8080/ShoppingCart/jsp/ValidateUser"

the servlet is under src/org.techniker. The flow should rather go to org.techniker package

I am getting the error http 404 resource not found.

Please help
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because you are using a page-relative URL in the action. Use a server-relative URL that starts with the context path. See the ServletsFaq fro more information.
 
shivang sarawagi
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Sir !! The spec cleared my concept on using relative links in a web app.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic