Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Acessing a managed bean from another managed bean

 
Anu kuriakose
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 17989
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
Anu kuriakose
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
extendsbean.jpg
[Thumbnail for extendsbean.jpg]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic