This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes JSF and the fly likes problem accessing data from another managedBean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "problem accessing data from another managedBean" Watch "problem accessing data from another managedBean" New topic
Author

problem accessing data from another managedBean

doinigly jaquel
Greenhorn

Joined: Aug 08, 2012
Posts: 6
I don't know how to access data from another managedBean,
I tested this from documentation :

but I have a problem with "context"
do you have any idea
thank you
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15661
    
  15

#1 rule for JSF. The more complex your solution, the more likely it's wrong.

One of the core design principles of JSF is Inversion of Control. In IoC, things don't "go out and get" other things (that's what Service Locators are for). Instead, they sit there all fat and happy and get them delivered via Injection.

JSF does this via Managed Properties. In JSF1, you defined Managed Properties in the faces-config.xml as part of your Managed Bean definition. That still works in JSF2, but you also can use the "@ManagedProperty" annotation. Like so:



This will cause JSF to invoke your setUserId() property access method to set the userId property without the need for gnarly JSF-specific code.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem accessing data from another managedBean
 
Similar Threads
How to pick values from data table....
Has anybody successfully run the Virtual Trainer application in "JSF Complete Reference"?
Differents between various techniques to access beans from other beans.
how I can pass attribute from one bean to another in jsf
how to bind value attribute inside another component binding attribute