posted 13 years ago
I suggest you study up on the JSF lifecycle.
JSF is based on HTTP, HTTP is a batch-mode protocol. It operates on the basis of submitted forms, unlike more interactive client/server systems where events travel to and from the server at the keystroke or field level. The "partialSubmit" attribute on your inputText control limits what fields on the form are submitted - otherwise all fields would be submitted when the associates action fired. The Save button has no such constraint, so all fields ARE submitted.
When a form (or partial form) is submitted to the server, the first thing that JSF does is validate all of the submitted control values. If even ONE of them fails validation, the processing is short-circuited and a response is sent back to the client with errors.
If you have converters, JSF will then convert the incoming values as needed. If a validator throws an exception, see above.
If validation AND conversion succeed, the incoming values are compared against the current property values of the backing bean(s). For properties whose present values differ from the incoming values, the associated valueChangeListener(s) are fired, passing in the new and old values plus the UIComponent of the associated control. No warrantees express or implied on what happens if you attempt to modify other values being listened to while in a listener and what works today may fail tomorrow.
Once all the the above has occurred, the backing bean(s) have their properties automatically updated. JSF takes the incoming data values and invokes the propery "set" methods to inject the updated values into the bean(s).
The bean has now been updated with guaranteed valid property values. Assuming you don't meddle with the process, it can be safely assumed that ALL backing bean property values are valid as defined by the constraints of the input controls, their validators and their converters.
Having done that, the source of the submit operation is examined and if there are actionListeners attached to it, those listeners are then fired. Finally, a check is made to see if there is an associated POJO action method and if so, that action method is invoked.
A partial submit can get away with invalid form values because only the submitted controls are passed through the JSF lifecycle. A full submit ("Save button") requires that ALL form controls have valid values, as explained above.
Experience keeps a dear School, but Fools will learn in no other.
---
Benjamin Franklin - Postal official and Weather observer