aspose file tools
The moose likes JSF and the fly likes Accessing the managed bean Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » JSF
Reply Bookmark "Accessing the managed bean" Watch "Accessing the managed bean" New topic
Author

Accessing the managed bean

Jithesh Kumar
Ranch Hand

Joined: Mar 09, 2010
Posts: 46
Hello all,

I have two war files in my jsf application.I would like to access the managed bean of second war file from the first war file.
Is it possible ?

Thanks in advance,

jithesh kumar
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 11740

Jithesh Kumar wrote:Hello all,

I have two war files in my jsf application.I would like to access the managed bean of second war file from the first war file.
Is it possible ?

Thanks in advance,

jithesh kumar


No. For most practical purposes, each WAR is running in a separate VM and what's in one VM cannot be directly accessed by any other VM.


A lot the of modern-day software development platforms are designed to permit parcelling out work to those with the best aptitude for it. A lot of modern-day business is predicated on making one person do all the work, regardless of aptitude.
Jithesh Kumar
Ranch Hand

Joined: Mar 09, 2010
Posts: 46
hi,

thank you for responding..

is it possible if the war is in same webserver ? , if not is there any solution in jsf for the above problem..

thanks,

Jithesh
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 11740

No, as far as resource management goes each webapp is totally isolated from every other webapp. In the Tomcat server, there is exactly one and only one WAR per webapp (and vice versa). In full-stack J(2)EE servers, a webapp may contain multiple WARs, but normally each WAR has its own unique classpath, so they can't share objects directly.

Webapps are supposed to be self-contained and not be looking outside themselves for code resources.

However, if you provide a web service interface (SOAP, REST or whatever) to the services of a class in a WAR, other WARs (webapps) can invoke those functionalities by making HTTP service requests.
Jithesh Kumar
Ranch Hand

Joined: Mar 09, 2010
Posts: 46

Is the following possible?

in tomcat there is an attribute called "crosscontext", which i think is used for cross context communication.
And after getting the other context, can we can pass the values of the first war to the second wars(jsp or servlet) through url

like this.../contextA/oneServlet?values=1


Thanks in advance

Jithesh


Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 11740

You might find this useful: http://www.softwaresecretweapons.com/jspwiki/apachetomcat

However, do remember that anything that you put in the tomcat shared library part of the classpath MUST be thread-safe!

Incidentally, the idea of providing a common set of functionalities sharable by multiple apps was what Enterprise JavaBeans was created for. However, Tomcat doesn't have built-in EJB support. There are ways to add it, however.
 
 
subject: Accessing the managed bean
 
developer file tools