A JSF component has following properties (conceptual)
a) a submitted value
b) a local value
c) a value

The submitted value is filled in in the Apply Request Values phase, typically 
in the decode method of the component.
The local value is filled in the Process Validations phase: this is the 
converted and validated submitted value. At that moment, the submitted value is 
cleared (only when conversion/validation succeeded).
When all conversions and validations succeed, the local value is set as the 
value of the component, which means that the value(binding)expression is 
evaluated to propagate the local value to the backing bean (setter). Again, at 
that moment, the local value of the component is cleared. Of course this 
happens in the Update Model Values phase.

When a page is being rendered, JSF will first look for a submitted value, if no 
submitted value is present, JSF will look for the local value of the component, 
if no local value is present, JSF will evaluate the value(binding)expression to 
get the value of the component (which is the value on the backing bean) 
(getter).

This should explain the magic of "a" and "b" :-). "a" never got further than 
the submitted value of the component, "b" made it to the local value of the 
component.

Now, why is the getter on the backing bean sometimes called in the process 
validations phase (or even in the Apply Request Values phase depending on the 
value of the immediate attribute)?
In the Process Validations phase, ValueChangeEvents are being queued. Of 
course, a ValueChangeEvent may only be queued when the value changed (duh), 
therefor JSF evaluates the value(binding)expression, to compare the local value 
of the component (mind "local value", this means this normally only happens 
when conversion and validation were successful) with the value of the component 
(i.e. the value on the backing bean), so the getter on the backing bean is 
called.
This explains why getTestString on the backingbean is being called.

As there are validation errors for the first field, you wouldn't expect 
getTestEntity being called. I guess this is a Seam thing (I think it happens in 
the validate(String,Object) method of the Expressions class (called from 
ModelValidator).


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4034920#4034920

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4034920
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to