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.
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.
Joined: Jul 03, 2007
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 ]
Joined: Jul 03, 2007
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’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com