Hi Andy,
>> Does anyone know why converted local value is kept at state by calling setValue().
>
> Isn't this done simply because we need some place to store the converted value until the update model phase?
Yes that's right but setValue places the value in state, so it will be restored and used in rendering even the users want to use the model value to clear it. Instead of making it stateful, if local value is set in component instance, that could solve this issue, but I'm not sure about if there will be any side effects.
> Specifying immediate="true" is definitely an important part of the solution, since without this the validation errors will be triggered again and the reset button's action listener won't be called. However, this is not sufficient, since input components will have their submittedValues set, masking the underlying (reset) values in the bean. As such, the application must both reset values in the bean *and* clear out local values stored in the inpupt components. Cagatay was hoping that we could find some standard way to simplify the second (non-obvious) part of this.
Yes for the same reason, immediate can't help here. Frameworks like Trinidad created solutions like resetActionListener to overcome this. Regarding resetActionListener, it does the job but it traverses all the components in tree, what if I want to reset a subtree like a children of a panel? Sure it could be done by improving the listener but I prefer a "core" solution.
In PrimeFaces, we have p:inputText, I'll try my workaround(not keeping local value in state) there to see if any problems come up.
Thanks,
On Jun 10, 2011, at 10:11 PM, Andy Schwartz wrote:
> Hey Cagatay -
>
> On 6/2/11 2:34 PM, Cagatay Civici wrote:
>> Does anyone know why converted local value is kept at state by calling setValue().
>
> Isn't this done simply because we need some place to store the converted value until the update model phase?
>
>
>> Both mojarra and myfaces keeps the value at state and I cannot find anything regarding this in spec, please point me if I'm wrong.
>
>
> Looks like this is covered in the javadoc for UIInput [1]:
>
>> By default, during the Process Validators phase of the request processing lifecycle, the submitted value will be converted to a typesafe object, and, if validation succeeds, stored as a local value using setValue().
>
> I agree with you that the current state of affairs is rather confusing/difficult, so definitely open to doing something here. One possible way to go is to expose a listener along the lines of Trindiad's tr:resetActionListener [2].
>
> Andy
>
> [1] http://javaserverfaces.java.net/nonav/docs/2.1/javadocs/javax/faces/component/UIInput.html
> [2] http://myfaces.apache.org/trinidad/trinidad-api/tagdoc/tr_resetActionListener.html
Çağatay Çivici
Principal Consultant
PrimeFaces Lead | JSF EG Member
Prime Teknoloji
Bilkent Cyberpark, A-303d
06800 Ankara/Turkey
Tel: +90 312 265 05 07
http://www.prime.com.tr