aspose file tools*
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
JavaRanch » Java Forums » Java » Servlets
Bookmark "calling servlet from jsp" Watch "calling servlet from jsp" New topic
Author

calling servlet from jsp

luca cillo
Greenhorn

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??
thanxs
Asher Tarnopolski
Ranch Hand

Joined: Jul 28, 2001
Posts: 260
read this book:
www.coreservlets.com


Asher Tarnopolski
SCJP,SCWCD
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:
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.
 
subject: calling servlet from jsp