-
1. Re: How to reset to null objects in backing bean after form validation errors.
niox.nikospara.yahoo.com Jun 10, 2010 4:06 PM (in response to virbooster)Hello,
This behavior is correct as per the JSF spec. Actually if a validation error occurs the server-side processing is interrupted, i.e. the model is not updated and actions are not called. This guarantees model consistency. Could you explain why does it cause you trouble?
-
2. Re: How to reset to null objects in backing bean after form validation errors.
virbooster Jun 10, 2010 4:48 PM (in response to virbooster)Hello Nikos, thanks for responding quickly.
I know is the correct JSF behavior and and every failed validation interrupts the processing.
The problem is: if you previously set a correct value to the date, that correct value was binded to the backing bean. If after that you change the same date but with and incorrect string, of course validation fails and stop every other processing. The backing bean holds the correct value and the visual interface holds the incorrect one.
I think the problem is that, additionally to this validation, another business validation is achieved in the backing bean in this method:
action="#{bean.update()}"
in order to display error messages and disabled a
next
button.Since that
date
is included as part of the business validation, if the backing bean holds theold correct
date, the business validation will pass without any trouble. But the visual interface is still displaying the wrong String.So, basically I want to know if there is some way to unificate the fact that: if I have a wrong visual value I want to be able to reset the date to null to make the business validation fail.
I found a link where is happening the same but with different values: http://stackoverflow.com/questions/368137/jsf-reset-value-on-failed-validation
My question is if this can be done.
Otherwise I should find another way to achive what I need in this particular case.Anyway thank you very much for your help.