This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I want to share a request scoped JSF bean in more than one view with h:inputText X and Y that will bind with member variables mX and mY.
But on Submit the bean should be intelligently invoke different processes. Say I have two views V1 and V2. One solution would be to define two funtions in JSF bean submitV1() and submitV2() and bind them
<h:commandButton id="submit" action="submitV1"> </h:commandButton> in V1 and similar expression in V2
But that would mean for every new view I have to write a new submit function. Can I define something like hidden input text that will set a hidden member variable mV to "V1" or "V2" implicitly without knowlege of user? The JSF bean then can intelligently decide how to handle the Submit. Basically, I need the JSF backup bean to figure which View is calling it.
You can instantiate a request-scope object with a property bound to an inputHidden object in the JSF View. It's perfectly OK to reference more than one backing bean on a view, even in different scopes.
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: Mar 17, 2009
Thanks Tim. This is exactly my line of thought. I must use somehow <h:inputhidden?> tag. But I cannot figure the syntax.
Let's say the request scoped backing bean name is MyBean.
The property name is String formName
In view V1 I want formName to get set to "V1".
How do I write <h:inputhidden ................ /> block?
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
subject: Can JSF backup bean tell which View is using it?