• Post Reply Bookmark Topic Watch Topic
  • New Topic

Access session Bean from another backing Bean

 
Daniel Breitner
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everybody,

I have the following issue:

I have a session bean containing some information that I want to access in another backing bean.
So bean2 should somehow have access to bean1.
I thought I could use managed-properties for that but somehow I canĀ“t find out how to do this.

Who can help me ?

with kind regards

daniel
 
Tim Holloway
Bartender
Posts: 18417
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are correct. Inject the second bean into the first bean:


This bean has 2 other beans injected into it - categoryService and categoryKeyService. So in addition to the faces-config info, there are public setter methods which I've given the same names as the injected beans. Like so:

public void setCategoryService( CategoryServiceBean injectedbean) {
this.categoryService = injectedbean;
}
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!