Meaningless Drivel is fun!
The moose likes Servlets and the fly likes Inter servlet communication Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Inter servlet communication" Watch "Inter servlet communication" New topic

Inter servlet communication

Kash Mhai

Joined: Apr 01, 2005
Posts: 29
I have a small issue with the servlets. I have two servlets which need to communicate to each other. But both of them are in different applications on different servers (Websphere) Is there a way in which these can communicate to each other? I need to pass all request attributes/parameters of one servlet to be available to the other servlet in another application? I thought of appending stuff to URL, but thats ruled out. Am not sure RequestDispatcher would work too...!

Any ideas?

-------------<br />There are wheels within wheels...<br />P.G Wodehouse
Amol Nayak
Ranch Hand

Joined: Oct 26, 2006
Posts: 218
I dont think there is anything in the javax.servlet package to help you out in this.
You can use some other api to create a new request and post the data (parameters and attributres) as parameters to the second servlet.
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

You're correct.
RequestDispatcher will not work.

This question gets asked a lot here so searching this forum should bring up a lot of information.
There are several ways for applications to communicate with one another.
The best depends on your details.

For simple communication, you could use or
the httpClient at

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Kash Mhai

Joined: Apr 01, 2005
Posts: 29
Thanks Ben,
I knew this was a frequently asked question, but i was not able to frame the exact text for framing the question. Maybe i'll start off with HttpClient

I agree. Here's the link:
subject: Inter servlet communication
It's not a secret anymore!