File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes calling servlet from jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "calling servlet from jsp" Watch "calling servlet from jsp" New topic

calling servlet from jsp

luca cillo

Joined: Aug 27, 2002
Posts: 2
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??
Asher Tarnopolski
Ranch Hand

Joined: Jul 28, 2001
Posts: 260
read this book:

Asher Tarnopolski
christoph weingarten
Ranch Hand

Joined: Oct 10, 2002
Posts: 39
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:
for a servlet located at your machine:
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.
I agree. Here's the link:
subject: calling servlet from jsp
jQuery in Action, 3rd edition