This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Servlets and the fly likes Calling Servlets in different Web applications? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "Calling Servlets in different Web applications?" Watch "Calling Servlets in different Web applications?" New topic
Author

Calling Servlets in different Web applications?

Karthi Bala
Ranch Hand

Joined: Jul 27, 2001
Posts: 48
Hi,
Can I call a method in a servlet which is instantiated in a web application from another servlet which is in different web application.
I don't want the instantiate the servlet again?
Thanks


Karthi Bala<br />SCJP 1.2, SCWCD 1.3, SCWCD 1.4, SCDJWS (Awaiting Result)<br /> <br />Where there is a will,there is a WAY.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17038
    
  26

I wouldn't recommend it. You can get into all sorts of trouble - the servlets may someday end up in separate VMs, so it would be physically impossible. Even if not, this is a dangerous way to organize things, as you're creating non-obvious dependencies both on data and on thread processes.
It would be safer if you could extract the common functionality into a component in its own right. For simple cases, this might just be a library class. If there's more complexity or shared data, I'd recommend looking at Enterprise JavaBeans.


An IDE is no substitute for an Intelligent Developer.
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Calling Servlets in different Web applications?
 
It's not a secret anymore!