This is what I want to do:
I have an input field where the user can fill in a number which contains information about a the birth date and the gender of a person. I also have an input field for gender and a field for the birth date. When the user fills in the first field the following shall happen: The number gets validated and if it is valid the information about the gender and the birth date will be extracted and the values will be written to the model. Now the other two fields shall be updated and show the values which where set before.
This is what I get:
when entering a valid number, the birth date field is rerendered but it remains empty. When I reload the page the field birth date contains the correct data.
This is what I coded:
This is what i guess:
Since the data in the field birth date is not changed at all from the view side, jsf does not reload the values from the model.
This is my question:
How can I achieve my goal to immediately show the correct/extracted data?
Thank You in advance for any suggestions and hints! :-)
Neither Validators nor Converters should be setting backing bean properties. They should only validate and convert. JSF itself will set the backing bean properties - providing that all submitted values are, in fact, valid.
In the event that you want one control to update the value of another control, the instigating control's action method should update the Model (backing bean) property. Once it has done this, the rendered response will reflect the updated bean property automatically. In the case of AJAX updates, of course, you do have to indicate the control(s) that require updating, which you do using the reRender attribute in the case of RichFaces a4j.
An IDE is no substitute for an Intelligent Developer.