This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have implemented a form in JSF with 10 components (combo box, text
boxes etc.). if any of the validation is failed in these components
then i want to clear the value of one particular component. e.g if
combo box is not selected then i want to clear one of the text boxes
Thanks in Advance
The woods are lovely, dark and deep, But I have promises to keep; And miles to go before I sleep, And miles to go before I sleep. - Robert Frost
Run a PhaseListener which listens on beforephase of render response and sets the submitted values of all UIInput components to null.
Sumeet Singh Aryan
Joined: Jul 30, 2008
But the code of phaseListener will execute on each and every request. i want to clear particular textbox on the single page not on all pages but at some validation error generated by another components
Joined: Oct 08, 2006
Just check if Iterator#hasNext() of FacesContext#getMessages() returns true and then change the component tree accordingly. If necessary also check the UIViewRoot#getViewId() if it matches the desired view.
Sumeet Aryan wrote:But the code of phaseListener will execute on each and every request. i want to clear particular textbox on the single page not on all pages but at some validation error generated by another components