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 am migrating a dhtml/ajax/spring web app to jsf on the front-end and am running into the following problem.
We have fields that are optionally rendered depending on a conditional flag that comes off the backend.
The bean is implmented as follows:
But the problem I have is within this method determining what form element has currently executed the method. Am I using the wrong approach here should I be using a phase listener not sure as new to JSF but any help much appreciated.
See if this helps - I'd be interested to know if that's the problem...
Joined: Feb 27, 2009
Not sure if the link posted previously is of any value as it relates to updating a jsf component based on user interaction this is not what I am trying to do. I will attempt to outline the problem domain:
I have a jsf page that before it loads in the browser I would like to exclude certain fields from being rendered in the response. Sounds fine if I had a traditional backing bean but this is not the case. The application is dhtml and js using ajax requests to get data back from the server - I don't want to change this for now but want the advanages of using the jsf component libs.
We have a client that does not want 3 fields on a particular form so I decided to convert this form to a jsf document so that I could use the jsf panel and the response would render fine no need for me to code the client to ensure that there was no gaps in the form. I have attempted to use the rendered attribute but this has not worked. I have coded a PhaseListener that gets me most of the way it excludes the 3 fields from the form but only after the inital request has been served, i.e. only on second request. I have played around with all the different phase types but none seem to be able to take the 3 fields out of the inital client response. If anyone was any ideas on how to manipulate the component tree for the initial request and render the response please let me know.