• 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Cannot Invoke Servlets

 
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 was working on a Web App project in NetBeans and I decided to move the location of my JSPs. I moved each JSP and remapped all of the links, however, it cannot invoke servlets even though the web.xml is correctly configured.

Is this a bug in Netbeans? I've tried changing web servers from tomcat to glassfish and same result.

I've attached the code for my servlet, the web.xml and link in jsp page. Basically, I'm trying to simply forward the user to another jsp page through a servlet. Please let me know any ideas or suggestions. Thanks, in advance.








Here is the link I'm using in my JSP to invoke the NewPoam servlet:
<a href='NewPoam'>New POAM</a>
 
Sheriff
Posts: 67756
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need a servlet mapping, and your URL should start with the 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 for the response. I thought anytime I create a servlet mapping in the web.xml file, I no longer need to add the context path, just simply name the servlet to match what is in the web.xml. Guess I was wrong as a newbie...

I added the 'context path/Servlet-name' and it works.

 
Bear Bibeault
Sheriff
Posts: 67756
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
Remember that the form action is on the client. The browser has no knowledge of your mappings, so you must use the context path.
 
We should throw him a surprise party. It will cheer him up. We can use this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic