This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Servlets and the fly likes interservlet communication Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "interservlet communication" Watch "interservlet communication" New topic
Author

interservlet communication

bala sub
Greenhorn

Joined: Nov 08, 2000
Posts: 6
hi
iam new to interservlet communication .But iam familiar with
servlet part.Now only i am planning to write interservlet
communication .iam using jswdk1.0.1 .using i can write interservlet communication .explain with few examples how one servlet communicates with the other servlet
greetings
bala
Senthil Nathan
Greenhorn

Joined: Nov 22, 2000
Posts: 3
Get the Servelt Context using getServletContext() method.
Then invoke a method on the Servlet Context object called getServlet("name of the servlet to be communicated")
Then cast the result to the specifed servlet and then use that refernce for ur further process.
Sample Code just a frame work) Servlet1 and Servlet2 are the
Servlet classes to be communicated.
public class Servlet1 extends HttpServlet
{
ServletContext cxt = getServletContext();
Servlet2 sl2 = (Servlet2)cxt.getServlet("Servlet2");
}
Hope this clear ur doubt!!!
If u have further doubts, let me know
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: interservlet communication