You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Julian Ray <ju...@yahoo.com> on 2006/06/03 00:20:30 UTC

RE: HtmlSelectOneMenu value is not set during ValueChangeListenerexecution

Hmmm, I always thought that the model had not been updated when the
ValueChangeListener event is sent in which case the value would be the old
value and the new value is only available via event.getNewvalue(). If you
call renderResponse() from the value change listener it bypasses all model
updates -- or am I misinformed?

-----Original Message-----
From: Tonio Caputo [mailto:tonioc@exeo.com.ar] 
Sent: Friday, June 02, 2006 5:49 PM
To: MyFaces-Users-List
Subject: HtmlSelectOneMenu value is not set during
ValueChangeListenerexecution

Hi everybody,

I'm changing my application to run with myfaces 1.1.1, it was developed
using sun's reference implementation, and it is working ok.

The problem I'm having is the value HtmlSelectOneMenu.getValue() returns
during the execution of ValueChangeListener.processValueChange() method.

In sun's reference implementation the returned value is the
event.getNewValue() in myfaces the returned value is event.getOldValue()

As I understand during the ApplyRequestValue Phase all the values from the
request are stored in the corresponding component, so sun's implementation
is correct.

May be I'm misunderstanding some spec, maybe my code is mistaken, but I'm
getting a lot of trouble because I'm assuming that the component's value is
the new one.

I will describe basically my application:

   FormData - All the values components/selectItems 
	      had in the last request
            - Session scope

   Page/JSP - Java Class with all the components transient
            - JSP page with all its components bound to the 
              Page's ones.
            - Request scope

   STATE_SAVING_METHOD is client.

   The readObject method of my Page is overridden, and this is what
   it is doing:
     1. calls in.defaultReadObject()
     2. creates all Html/UISelectItems components
     3. FormData values (components and selectItems) are
        stored in the recently created components

Any help or comment will be welcomed

Thanks in advance
tonio
PD: I was really surprised not to find any e-mails regarding this problem in
the list.






Re: HtmlSelectOneMenu value is not set during ValueChangeListenerexecution

Posted by Tonio Caputo <to...@exeo.com.ar>.
Mario,

   Not a all, but it will be of great help.

   I'm just beginning to use myfaces features, for now
I'm just adapting my application to work as it is (using sun's
implementation).

Thank you very much
tonio

On Sat, 2006-06-03 at 08:56 +0200, Mario Ivankovits wrote:
> Hi Tonio,
> 
> You are aware about our s:valueChangeNotifier which behaves like
> ValueChangeListener with the difference that it will fire AFTER the
> updateModel phase?
> 
> Ciao,
> Mario
> >     
> >    ValueChangeListeners are called after Process Validators Phase, and
> > the model (Components values) is only updated (in the Update Model
> > Values Phase) after processing the ValueChange events.
> >   
> 


Re: HtmlSelectOneMenu value is not set during ValueChangeListenerexecution

Posted by Mario Ivankovits <ma...@ops.co.at>.
Hi Tonio,

You are aware about our s:valueChangeNotifier which behaves like
ValueChangeListener with the difference that it will fire AFTER the
updateModel phase?

Ciao,
Mario
>     
>    ValueChangeListeners are called after Process Validators Phase, and
> the model (Components values) is only updated (in the Update Model
> Values Phase) after processing the ValueChange events.
>   


RE: HtmlSelectOneMenu value is not set during ValueChangeListenerexecution

Posted by Tonio Caputo <to...@exeo.com.ar>.
Thanks Julian,

   You made me reread faces docs, you are right.
    
   ValueChangeListeners are called after Process Validators Phase, and
the model (Components values) is only updated (in the Update Model
Values Phase) after processing the ValueChange events.

   Well I must correct my code, and simply trust myfaces implementation.

   This is my third conflict between sun's implementation and myfaces, 
and in all cases myfaces was correct.


Thanks again
tonio

On Fri, 2006-06-02 at 18:20 -0400, Julian Ray wrote:
> Hmmm, I always thought that the model had not been updated when the
> ValueChangeListener event is sent in which case the value would be the old
> value and the new value is only available via event.getNewvalue(). If you
> call renderResponse() from the value change listener it bypasses all model
> updates -- or am I misinformed?
> 
> -----Original Message-----
> From: Tonio Caputo [mailto:tonioc@exeo.com.ar] 
> Sent: Friday, June 02, 2006 5:49 PM
> To: MyFaces-Users-List
> Subject: HtmlSelectOneMenu value is not set during
> ValueChangeListenerexecution
> 
> Hi everybody,
> 
> I'm changing my application to run with myfaces 1.1.1, it was developed
> using sun's reference implementation, and it is working ok.
> 
> The problem I'm having is the value HtmlSelectOneMenu.getValue() returns
> during the execution of ValueChangeListener.processValueChange() method.
> 
> In sun's reference implementation the returned value is the
> event.getNewValue() in myfaces the returned value is event.getOldValue()
> 
> As I understand during the ApplyRequestValue Phase all the values from the
> request are stored in the corresponding component, so sun's implementation
> is correct.
> 
> May be I'm misunderstanding some spec, maybe my code is mistaken, but I'm
> getting a lot of trouble because I'm assuming that the component's value is
> the new one.
> 
> I will describe basically my application:
> 
>    FormData - All the values components/selectItems 
> 	      had in the last request
>             - Session scope
> 
>    Page/JSP - Java Class with all the components transient
>             - JSP page with all its components bound to the 
>               Page's ones.
>             - Request scope
> 
>    STATE_SAVING_METHOD is client.
> 
>    The readObject method of my Page is overridden, and this is what
>    it is doing:
>      1. calls in.defaultReadObject()
>      2. creates all Html/UISelectItems components
>      3. FormData values (components and selectItems) are
>         stored in the recently created components
> 
> Any help or comment will be welcomed
> 
> Thanks in advance
> tonio
> PD: I was really surprised not to find any e-mails regarding this problem in
> the list.
> 
> 
> 
> 
>