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.
2) textBean is a request-scoped backing bean with textValue attribute and its setters and getters
3) managedBean is the RAD-generated, request-scoped bean with all the component getters, in which I have the showText action as foll
Question: Is there a better (simpler) way to code for the above requirement? I am still trying to get my head around the lifecycle..so forgive this question..isn't it possible to do a simple text2.value=text1.value somewhere?
Sue Pillai wrote:.isn't it possible to do a simple text2.value=text1.value somewhere?
Use only one bean either RAD generated or what you have coded!
Joined: Nov 04, 2004
True, but I meant the showText() method..getting the facesContext instance, getexternalcontext, etc..etc..till you set it back as an attribute. I was thinking my approach was long-winded and there was a shorter way
You didn't supply a value attribute on the text1 control. Therefore, the MVC controller has no Model to get/set with the contents of that form control. You need something more like this:
To achieve your purpose, the the showText action needs to do something like this:
You don't need a navigation rule in JSF2 if you're re-displaying the same View. If you place the showText method in the textBean instead of its own bean and are following the POJO JavaBean conventions, you can also code:
As a general rule, the only objects and classes from the javax.faces packages that most JSF code should be using are the SelectItem and DataTable model wrapper classes. When you start referencing the FacesContext and/or non-model JSF classes, there's a good chance you're not doing it right.
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: Nov 04, 2004
This is exactly what I was looking for. The model is much simpler now.
Tim Holloway wrote:
When you start referencing the FacesContext and/or non-model JSF classes, there's a good chance you're not doing it right