This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Servlets and the fly likes Application level communication Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Application level communication" Watch "Application level communication" New topic

Application level communication

Vrushali Gore
Ranch Hand

Joined: Oct 17, 2005
Posts: 40
I have designed two web applications using servlets. Can servlet of one web application communicate with servlet of another web application
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

It depends on what you mean by communicate.

Can you tell us what you're trying to do?

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Vrushali Gore
Ranch Hand

Joined: Oct 17, 2005
Posts: 40
I want to send some data from servlet in one web application to servlet in another web application.

Let's say I am having 2 webapps like abc.war(having servlet A) & xyz.war(having servlet B) so from now servlet A data is to be transferred to servlet B

Thanks for your reply.
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42958
There are any number of ways: HTTP (which might be easiest), shared files, web service, JMS, Email, shared DB, TCP/IP, ...

Direct access to objects or sessions in another web app can be enabled on some servlet engines, but is server-specific. For Tomcat, have a look at the crossContext attribute of the Context. It enables the use of RequestDispatchers across web apps.
[ August 24, 2006: Message edited by: Ulf Dittmer ]
Vrushali Gore
Ranch Hand

Joined: Oct 17, 2005
Posts: 40
Thanks for your reply.
Do Tomcat only provides the way? Servlet technology is not having any approach to this. Suppose if two webapps are running in the same webserver or two webapps are running in differnet servers do i will have to go for some other mechanism?

If you can elaborate your answer more i would be very thankful to you.

Thnaks once again.
I agree. Here's the link:
subject: Application level communication
jQuery in Action, 3rd edition