This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

communication between 2 session beans

 
Chad Foor
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a situation where it makes sense in the code to have 2 session beans declared in faces-config.xml to talk to one another.

The basic form stuff is declared in a session bean I call 'inputForm' (alias) and a helper bean called 'helper'. It makes sense to not have a concrete instance of the helper bean declared as an object within inputForm per se, but rather I need it to be called from my JSP page(s) directly. I just need to have 2 internal variables set between both the session beans using getters / setters.

How can I accomplish this ? (if it's possible ?)

Appreciate any help.

Thanks,
Chad
 
Majid Al-Fifi
Ranch Hand
Posts: 45
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you aware you can "inject" one bean into another in faces-config.xml?

you can use helper directly in your jsp if you have defined it faces-config.xml as a managed bean and if helper needs something form another bean then inject that other bean into helper.

regards

Majid
 
Chad Foor
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm aware of being able to reference 'helper' bean directly in my JSP by
declaring a managed-bean in my faces-config.xml.

What I want to do is reference the 'helper' bean directly from my 'inputForm' bean. Both beans are declared as managed-beans in the faces-config.xml file.

'helper' bean contains the information I need to display a datatable. (something that I'd originally declared to get something working inside the 'inputForm' bean.) But now, I want to separate that code out into its own class(bean) into 'helper' and reference that directly.

I'm using JSF 1.1 here. The books I'm looking at only hint at the ability to do a dependency injection, which is what I want here, but do not show a concrete example of how to do this.

I'm looking for a good code example of how to do this.

Appreciate any help.

Thanks,
Chad
[ November 16, 2007: Message edited by: Chad Foor ]
 
Chad Foor
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I figured it out. What I was looking for was a ValueBinding item that allowed me to set a property in the helper class from the input form class. (Was pretty painless once I stared at the Managed Bean sections of my JSF texts.) (just didnt know what it was 'called' per se. )
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic