aspose file tools*
The moose likes JSP 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 Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Calling Servlet from JSP" Watch "Calling Servlet from JSP" New topic
Author

Calling Servlet from JSP

Anupama Dande
Greenhorn

Joined: May 09, 2003
Posts: 10
How do we call a Servlet from a JSP?
What are the steps involved?
Ravi Kumar Ravuru
Ranch Hand

Joined: Apr 18, 2002
Posts: 176
Hello Anupama Dande,
Calling a servlet from JSP as same as calling another JSP from JSP except if the servlet is mapped with different name..u have to call the servlet with the name specified at URL Mapping of the servlet at web.xml file.Hope this helps.
Ravi
Malhar Barai
Author
Ranch Hand

Joined: Aug 17, 2001
Posts: 399
Originally posted by Anupama Dande:
How do we call a Servlet from a JSP?
What are the steps involved?

Hi,
What exactly do you want to do, as there are more than one way to call servlet from JSP.
Please give some more info.
MB


Malhar Barai
SOA & Java Book
kavitha rama
Ranch Hand

Joined: Jun 18, 2003
Posts: 38
Hi, Its just like calling other JSP except that precede it with 'servlet'
ex: /servlet/page
where page is servlet, don't give any extension
Wendal Park
Ranch Hand

Joined: Aug 28, 2001
Posts: 39
Say if your servlet TestServlet is compiled under the package:
com.yourproject.servlet
Then in your JSP, code something like this
<form name=yourName method=POST action="com.yourproject.servlet.TestServlet">
Make sure you have your app server and classpath set accordingly.


MSc, BSc, SCJP 1.4<br /> <img src="graemlins/banghead.gif" border="0" alt="[banghead]" /> SCBCD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calling Servlet from JSP