• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

calling servlet from jsp

 
luca cillo
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how can i call a servlet from a jsp?
i can set the action property of the form, i tried but didn't work out...
can i map my servlet in the web.xml file or something like that??
thanxs
 
Asher Tarnopolski
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
read this book:
www.coreservlets.com
 
christoph weingarten
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi luca,
you can acces a servlet from any (maybe generated) html-page via a form.
first of all you should try to talk to your servlet directly. try to reach it with your browser.
for tomcat as your servlet-engine it would be:
http://localhost:8080/examples/servlet/Helloworld
for a servlet located at your machine:
../webapps/examples/WEB-INF/classes/Helloworld.class
the url depends on how you mapped the servlet in your web.xml.
if this works you can set your form-action to:
<form action="/examples/servlet/Helloworld" ../>
this would submit the form-data to your servlet.
christoph
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic