• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Bear Bibeault
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • salvin francis
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Jj Roberts

Cannot Invoke Servlets

 
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>
 
Marshal
Posts: 67478
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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
Marshal
Posts: 67478
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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.
 
This is my favorite tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic