jsf table edit : retaining original values in bean in case reset button is pressed for row
I have a data bean collection bind with my tomhawk table. Now lets say i want to edit a row, so i make all the fields in that 开发者_StackOverflowrow editable and change values inside them, but on second thought i press "cancel edit" button.
To make all the fields editable, i have a flag in the bean bind with field's "readonly" property. So when i press "reset" button, i set that flag to false.
Now problem is if i change values in field and then press "reset" button, values are updated in binding bean and original values are gone. Also i can query database only i case of modification.
SO how to retain original values in the bean here.
I am using JSF 1.2 and tomahawk components.
Add immediate="true"
to the command button. This way all input elements which are not set with immediate="true"
will be skipped.
See also
- Debug JSF lifecycle - Explains among others the use of
immediate
attribute.
精彩评论