Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP to Servlet call

 
eswar kumar
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to call a servlet from a JSP page?
 
Benny Tang
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
In order to call servlet from the JSP page, you can achieve this by setting the attribute action of the <form> in HTML to the servlet and then submit the form.
Benny T
 
Nagaseshagiri poola
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,
In order to call the servlet from JSP page u can add the
<form name="" action="SERVLET_PATH">
</form>
It is one method and u can also call servlet using the JavaScript in the <head> tag of the .jsp page
and also directly from the anchor <a> Tag.
Have a nice time
 
Matthew Phillips
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you need to call it from outside of a form, you can use a link to the url of the servlet. It would look like:

[ November 19, 2003: Message edited by: Matthew Phillips ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic