Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cannot Invoke Servlets

 
Ron Ingram
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • 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>
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64683
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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
  • 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
Author and ninkuma
Marshal
Pie
Posts: 64683
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic