aspose file tools*
The moose likes JSF and the fly likes Acessing a managed bean from another managed bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Acessing a managed bean from another managed bean" Watch "Acessing a managed bean from another managed bean" New topic
Author

Acessing a managed bean from another managed bean

Anu kuriakose
Greenhorn

Joined: Mar 13, 2011
Posts: 6
Hi,
I am new to jsf.My problem is I am not able to access a property value from one bean in another bean..can somebody please help.
I have an addressBook bean.I want to access this bean in my groups bean,where both my beans are session scoped. I Tried using @ManagedProperty but did not get a result.This is how i do it.

@ManagedBean
@SessionScoped
public class Groups extends GroupStore {
@ManagedProperty(value="#{addressBook}")
private AddressBook a;
public void setA(AddressBook a) {
this.a = a;
}


But it gives this eror .

Unable to create managed bean groups. The following problems were found: - Property addressBook for managed bean groups does not exist. Check that appropriate getter and/or setter methods exist.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16305
    
  21

Welcome to the Javaranch, Anu!

You're doing it right. Almost.

You apparently didn't publish a bean named "addressBook". If you're using the annotations on the AddressBook class, make sure that you have the "@ManagedBean" annotation set up correctly in AddressBook.java.


Customer surveys are for companies who didn't pay proper attention to begin with.
Anu kuriakose
Greenhorn

Joined: Mar 13, 2011
Posts: 6
Thank you soo much for the reply.....ys now its working properly. I had done some mistakes in my web-config.xml Thank u
Lito Juliano
Greenhorn

Joined: Sep 20, 2012
Posts: 1
I having the same problem.
How to get value from extends bean?

in my class
public class c002Bean extends LoginMB {
....


}

in my LoginMB i have a value of email field.
how do?


[Thumbnail for extendsbean.jpg]

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Acessing a managed bean from another managed bean