Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

calling a servlet from a JSP

 
Priya Rangan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
What is the best way to call a servlet from a JSP page?
Here is what I want to do: I have a JSP page on one end and an EJB on the other. I want to inert a sevlet in between that would make a call to the EJB methods and do some processing before the results are displayed .
Please help.
Thanks,
Priya
 
Jai Sund
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Priya,
One idea is to have some sort of link in your JSP page and on clicking that you can execute your servlet class. For example,
<a href="<%=ctxPath%>/yourServlet">
<img src="<%=imgPath%>\btn_your_servlet.gif">
</a>
Inside your servlet you can then do the trick to access your EJB. Hope this helps.
cheers,
-Jai
 
Sean MacLean
author
Ranch Hand
Posts: 621
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Priya",
Thanks for participating here at the Ranch. However, the name you are using does not comply with our naming convention described at http://www.javaranch.com/name.jsp . Please log in with a new name, which meets these requirements.
You can change your name here.
Thanks.
Sean
 
Priya Rangan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jai, thanks a lot for that!!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!