You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by David Boyd <db...@indauto.com.au> on 2006/06/14 07:26:52 UTC
RE: Re: Re: inputText not updating from valueChangedListener b=uiHnFQ/OI6ffgtiEOG3tJasR/b3KIloGE0HVZIA/gXjDXV5uj+brPkcfAA1+oua/vOI4odr6PVJv/WBc9KI6BmuIpaX89n48F32n/eWZylcJ6jCZ3joEMg1XLwoFt0CH5NV3gbN2tbhjlyfvLRq38xG16WMYpPTuTxQSvd/eCkE= b=e8
:) I know how the component works assuming he just queues the
valueChangedEvent
I have blogged alternate solutions as well
http://java-server-faces.blogspot.com/2006/04/valuechangelisteners-what-
you-need-to.html
but what I want to know is why?
Why does this happen is it a bug? An error in the specification etc?
Why does it update for output components and not for input components?
:)
-----Original Message-----
From: mwessendorf@gmail.com [mailto:mwessendorf@gmail.com] On Behalf Of
Matthias Wessendorf
Sent: Wednesday, June 14, 2006 3:19 PM
To: MyFaces Discussion
Subject: [SPAM] Re: Re: inputText not updating from valueChangedListener
b=uiHnFQ/OI6ffgtiEOG3tJasR/b3KIloGE0HVZIA/gXjDXV5uj+brPkcfAA1+oua/vOI4od
r6PVJv/WBc9KI6BmuIpaX89n48F32n/eWZylcJ6jCZ3joEMg1XLwoFt0CH5NV3gbN2tbhjly
fvLRq38xG16WMYpPTuTxQSvd/eCkE= b=e8e1XF
that guy deliveres the event later. (custom event)
Regards,
Matthias
On 6/13/06, David Boyd <db...@indauto.com.au> wrote:
> But then you have the problem where the setter methods are called
after
> valueChanged code
>
> i.e
>
> Any variables in your beans you change in your valueChanged methods
will
> be overwritten by your setter methods
>
>
> This is a common problem
>
> Just check out
>
> http://www.irian.at/myfaces-sandbox/valueChangeNotifier.jsf
>
> There is even a component to overcome the deficiencies in value
Changed
> methods
>
> I am more curious to know why this happens? I have a found solutions
to
> fix this problem e.g sandbox valueChangeNoifier
>
>
>
>
>
> -----Original Message-----
> From: mwessendorf@gmail.com [mailto:mwessendorf@gmail.com] On Behalf
Of
> Matthias Wessendorf
> Sent: Wednesday, June 14, 2006 2:50 PM
> To: MyFaces Discussion
> Subject: [SPAM] Re: inputText not updating from valueChangedListener
>
b=uiHnFQ/OI6ffgtiEOG3tJasR/b3KIloGE0HVZIA/gXjDXV5uj+brPkcfAA1+oua/vOI4od
>
r6PVJv/WBc9KI6BmuIpaX89n48F32n/eWZylcJ6jCZ3joEMg1XLwoFt0CH5NV3gbN2tbhjly
> fvLRq38xG16WMYpPTuTxQSvd/eCkE=
>
> have you tried without responsecomplete() ?
>
> On 6/13/06, David Boyd <db...@indauto.com.au> wrote:
> >
> >
> >
> >
> >
> >
> > Hey all,
> >
> >
> >
> > I know this problem most likely would have been addressed before but
> was
> > just wondering if there has been any solution for it?
> >
> >
> >
> > Say you had
> >
> >
> >
> > <t:selectOneMenu value="#{bean.test}"
> >
> > onchange="submit();"
> >
> > valueChangeListener="#{bean.changedMethod}">
> >
> > <f:selectItem itemValue="a" itemLabel="a"/>
> >
> > <f:selectItem itemValue="b" itemLabel="b"/>
> >
> > </t:selectOneMenu>
> >
> >
> >
> > <t:inputText value="#{bean.userName}" />
> >
> > <t:outputText " value="#{bean.userName}" />
> >
> >
> >
> >
> >
> >
> >
> > and you have the value change method
> >
> >
> >
> >
> >
> > private userName;
> >
> > //getters and setters for userName
> >
> >
> >
> > public void changedMethod(ValueChangeEvent event)
> >
> > {
> >
> > userName = "someValue";
> >
> > FacesContext.getCurrentInstance().renderResponse();
> >
> > }
> >
> >
> >
> >
> >
> >
> >
> > Just wondering why does the outputText update but the inputText does
> not?
> > i.e why does the outputText display "someValue" and the inputText is
> still
> > empty?
> >
> >
> >
> > I know if you bind the inputText and call the setSubmittedValue()
you
> can
> > update the inputText
> >
> >
> >
> > Just wondering if I can get an explanation of why this problem
occurs?
> >
> >
> >
> >
>
>
> --
> Matthias Wessendorf
> Aechterhoek 18
> 48282 Emsdetten
> blog: http://jroller.com/page/mwessendorf
> mail: mwessendorf-at-gmail-dot-com
>
>
>
>
>
>
>
--
Matthias Wessendorf
Aechterhoek 18
48282 Emsdetten
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com
Re: inputText not updating from valueChangedListener b=uiHnFQ/OI6ffgtiEOG3tJasR/b3KIloGE0HVZIA/gXjDXV5uj+brPkcfAA1+oua/vOI4odr6PVJv/WBc9KI6BmuIpaX89n48F32n/eWZylcJ6jCZ3joEMg1XLwoFt0CH5NV3gbN2tbhjlyfvLRq38xG16WMYpPTuTxQSvd/eCkE=
b=e8
Posted by Jeff Bischoff <jb...@klkurz.com>.
Meghana,
Thanks for replying.
Yes, I have separated the renderResponse call away from the refresh
method in my code too. In fact, since that call is somewhat unrelated,
I'm going to update the wiki to indicate that it's optional.
I take it that your select menu is an immediate component. It is true
that if you call renderReponse in an immediate changeValueListener, the
setter method will never be called on the backing bean. It's a good idea
then to call the setter method manually, as you have done. When you
choose to also refresh the view, this becomes even more necessary, as
not only does the backing bean not get updated, but also the local value
gets wiped out along with the view. I think perhaps this is worth a
hint in the wiki too.
I have updated the wiki page with these minor changes. Feel free to fill
some in yourself, if I've missed anything. :)
Regards,
Jeff Bischoff
Kenneth L Kurz & Assoc, Inc.
Meghana wrote:
> Jeff,
>
> I have a changeValuelistener associated with a dropdown item. The
> problem is when I do a refresh its changing the value of dropdown item
> to the old value. But the user tried to change it. In order to show the
> latest selected value to the user, I am calling a setter on the dropdown
> item field in the backing bean.
>
> Here is the code snippet:
> public void refresh() {
> FacesContext context = FacesContext.getCurrentInstance();
> Application application = context.getApplication();
> ViewHandler viewHandler = application.getViewHandler();
> UIViewRoot viewRoot = viewHandler.createView(context,
> context.getViewRoot().getViewId());
> context.setViewRoot(viewRoot);
> }
>
> public void statusChanged(ValueChangeEvent event) throws
> SQLException, Exception{
> System.out.println("In the status changed value change listener");
> FacesContext context = FacesContext.getCurrentInstance();
> String prevCategorySelected = (String)event.getOldValue();
> String newCategorySelected = (String)event.getNewValue();
> if(!newCategorySelected.equalsIgnoreCase(prevCategorySelected)){
> // Value changed. Change the drop down values.
> System.out.println("The values are: "+prevCategorySelected+"
> - "+newCategorySelected);
> if(newCategorySelected.equals("Other")){
> otherStatusSelected = true;
> }
> else{
> otherStatusSelected = false;
> }
> refresh();
> status = newCategorySelected;
> context.renderResponse();
> }
> }
>
> Also please note that I moved renderResponse call out of the refresh
> method. We want to set the dropdown to the latest value just before
> transferring the control to the page. Hope that makes sense.
>
> Thanks,
> Hemanth
> */Jeff Bischoff <jb...@klkurz.com>/* wrote:
>
> Meghana,
>
> Can you go into a little more detail about what you were trying to do,
> how it didn't work, and how you solved it? If it is something that
> others may run into, then we should update the wiki page to include
> it. :)
>
> Regards,
>
> Jeff Bischoff
> Kenneth L Kurz & Assoc, Inc.
>
> Meghana wrote:
> > The link to ClearInputComponents works like a charm. Just one
> > modification though. It was resetting the changed field value to
> the old
> > value. So I had to do call its setter from the change value method
> > before calling renderResponse().
> >
> > Hope it helps,
> > -M
> >
> > */Jeff Bischoff /* wrote:
> >
> > I had a similar problem in the last few days, and someone pointed
> me to
> > this wiki page (which has some alternative solutions compared to the
> > link you posted) [1]
> >
> > As for why...?
> >
> > [1] http://wiki.apache.org/myfaces/ClearInputComponents
> >
> > David Boyd wrote:
> > > :) I know how the component works assuming he just queues the
> > > valueChangedEvent
> > >
> > > I have blogged alternate solutions as well
> > >
> > >
> >
> http://java-server-faces.blogspot.com/2006/04/valuechangelisteners-what-
> > > you-need-to.html
> > >
> > > but what I want to know is why?
> > >
> > > Why does this happen is it a bug? An error in the specification
> etc?
> > >
> > > Why does it update for output components and not for input
> > components?
> > > :)
> > >
> > >
> > >
> > >
> > >
> > >
> > > -----Original Message-----
> > > From: mwessendorf@gmail.com [mailto:mwessendorf@gmail.com] On
> > Behalf Of
> > > Matthias Wessendorf
> > > Sent: Wednesday, June 14, 2006 3:19 PM
> > > To: MyFaces Discussion
> > > Subject: [SPAM] Re: Re: inputText not updating from
> > valueChangedListener
> > >
> >
> b=uiHnFQ/OI6ffgtiEOG3tJasR/b3KIloGE0HVZIA/gXjDXV5uj+brPkcfAA1+oua/vOI4od
> > >
> >
> r6PVJv/WBc9KI6BmuIpaX89n48F32n/eWZylcJ6jCZ3joEMg1XLwoFt0CH5NV3gbN2tbhjly
> > > fvLRq38xG16WMYpPTuTxQSvd/eCkE= b=e8e1XF
> > >
> > > that guy deliveres the event later. (custom event)
> > >
> > > Regards,
> > > Matthias
> > >
> > > On 6/13/06, David Boyd wrote:
> > >
> > >>But then you have the problem where the setter methods are called
> > >
> > > after
> > >
> > >>valueChanged code
> > >>
> > >>i.e
> > >>
> > >>Any variables in your beans you change in your valueChanged methods
> > >
> > > will
> > >
> > >>be overwritten by your setter methods
> > >>
> > >>
> > >>This is a common problem
> > >>
> > >>Just check out
> > >>
> > >>http://www.irian.at/myfaces-sandbox/valueChangeNotifier.jsf
> > >>
> > >>There is even a component to overcome the deficiencies in value
> > >
> > > Changed
> > >
> > >>methods
> > >>
> > >>I am more curious to know why this happens? I have a found
> solutions
> > >
> > > to
> > >
> > >>fix this problem e.g sandbox valueChangeNoifier
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>-----Original Message-----
> > >>From: mwessendorf@gmail.com [mailto:mwessendorf@gmail.com] On
> Behalf
> > >
> > > Of
> > >
> > >>Matthias Wessendorf
> > >>Sent: Wednesday, June 14, 2006 2:50 PM
> > >>To: MyFaces Discussion
> > >>Subject: [SPAM] Re: inputText not updating from
> valueChangedListener
> > >>
> > >
> > >
> >
> b=uiHnFQ/OI6ffgtiEOG3tJasR/b3KIloGE0HVZIA/gXjDXV5uj+brPkcfAA1+oua/vOI4od
> > >
> > >
> >
> r6PVJv/WBc9KI6BmuIpaX89n48F32n/eWZylcJ6jCZ3joEMg1XLwoFt0CH5NV3gbN2tbhjly
> > >
> > >>fvLRq38xG16WMYpPTuTxQSvd/eCkE=
> > >>
> > >>have you tried without responsecomplete() ?
> > >>
> > >>On 6/13/06, David Boyd wrote:
> > >>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>Hey all,
> > >>>
> > >>>
> > >>>
> > >>>I know this problem most likely would have been addressed
> before but
> > >>
> > >>was
> > >>
> > >>>just wondering if there has been any solution for it?
> > >>>
> > >>>
> > >>>
> > >>>Say you had
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>> onchange="submit();"
> > >>>
> > >>> valueChangeListener="#{bean.changedMethod}">
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>and you have the value change method
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>private userName;
> > >>>
> > >>>//getters and setters for userName
> > >>>
> > >>>
> > >>>
> > >>>public void changedMethod(ValueChangeEvent event)
> > >>>
> > >>> {
> > >>>
> > >>> userName = "someValue";
> > >>>
> > >>> FacesContext.getCurrentInstance().renderResponse();
> > >>>
> > >>> }
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>Just wondering why does the outputText update but the
> inputText does
> > >>
> > >>not?
> > >>
> > >>>i.e why does the outputText display "someValue" and the
> inputText is
> > >>
> > >>still
> > >>
> > >>>empty?
> > >>>
> > >>>
> > >>>
> > >>>I know if you bind the inputText and call the setSubmittedValue()
> > >
> > > you
> > >
> > >>can
> > >>
> > >>>update the inputText
> > >>>
> > >>>
> > >>>
> > >>>Just wondering if I can get an explanation of why this problem
> > >
> > > occurs?
> > >
> > >>>
> > >>>
> > >>>
> > >>
> > >>--
> > >>Matthias Wessendorf
> > >>Aechterhoek 18
> > >>48282 Emsdetten
> > >>blog: http://jroller.com/page/mwessendorf
> > >>mail: mwessendorf-at-gmail-dot-com
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >
> > >
> > >
> >
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam? Yahoo! Mail has the best spam protection around
> > http://mail.yahoo.com
> >
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
Re: inputText not updating from valueChangedListener b=uiHnFQ/OI6ffgtiEOG3tJasR/b3KIloGE0HVZIA/gXjDXV5uj+brPkcfAA1+oua/vOI4odr6PVJv/WBc9KI6BmuIpaX89n48F32n/eWZylcJ6jCZ3joEMg1XLwoFt0CH5NV3gbN2tbhjlyfvLRq38xG16WMYpPTuTxQSvd/eCkE= b=e8
Posted by Meghana <sy...@yahoo.com>.
Jeff,
I have a changeValuelistener associated with a dropdown item. The problem is when I do a refresh its changing the value of dropdown item to the old value. But the user tried to change it. In order to show the latest selected value to the user, I am calling a setter on the dropdown item field in the backing bean.
Here is the code snippet:
public void refresh() {
FacesContext context = FacesContext.getCurrentInstance();
Application application = context.getApplication();
ViewHandler viewHandler = application.getViewHandler();
UIViewRoot viewRoot = viewHandler.createView(context, context.getViewRoot().getViewId());
context.setViewRoot(viewRoot);
}
public void statusChanged(ValueChangeEvent event) throws SQLException, Exception{
System.out.println("In the status changed value change listener");
FacesContext context = FacesContext.getCurrentInstance();
String prevCategorySelected = (String)event.getOldValue();
String newCategorySelected = (String)event.getNewValue();
if(!newCategorySelected.equalsIgnoreCase(prevCategorySelected)){
// Value changed. Change the drop down values.
System.out.println("The values are: "+prevCategorySelected+" - "+newCategorySelected);
if(newCategorySelected.equals("Other")){
otherStatusSelected = true;
}
else{
otherStatusSelected = false;
}
refresh();
status = newCategorySelected;
context.renderResponse();
}
}
Also please note that I moved renderResponse call out of the refresh method. We want to set the dropdown to the latest value just before transferring the control to the page. Hope that makes sense.
Thanks,
Hemanth
Jeff Bischoff <jb...@klkurz.com> wrote: Meghana,
Can you go into a little more detail about what you were trying to do,
how it didn't work, and how you solved it? If it is something that
others may run into, then we should update the wiki page to include it. :)
Regards,
Jeff Bischoff
Kenneth L Kurz & Assoc, Inc.
Meghana wrote:
> The link to ClearInputComponents works like a charm. Just one
> modification though. It was resetting the changed field value to the old
> value. So I had to do call its setter from the change value method
> before calling renderResponse().
>
> Hope it helps,
> -M
>
> */Jeff Bischoff /* wrote:
>
> I had a similar problem in the last few days, and someone pointed me to
> this wiki page (which has some alternative solutions compared to the
> link you posted) [1]
>
> As for why...?
>
> [1] http://wiki.apache.org/myfaces/ClearInputComponents
>
> David Boyd wrote:
> > :) I know how the component works assuming he just queues the
> > valueChangedEvent
> >
> > I have blogged alternate solutions as well
> >
> >
> http://java-server-faces.blogspot.com/2006/04/valuechangelisteners-what-
> > you-need-to.html
> >
> > but what I want to know is why?
> >
> > Why does this happen is it a bug? An error in the specification etc?
> >
> > Why does it update for output components and not for input
> components?
> > :)
> >
> >
> >
> >
> >
> >
> > -----Original Message-----
> > From: mwessendorf@gmail.com [mailto:mwessendorf@gmail.com] On
> Behalf Of
> > Matthias Wessendorf
> > Sent: Wednesday, June 14, 2006 3:19 PM
> > To: MyFaces Discussion
> > Subject: [SPAM] Re: Re: inputText not updating from
> valueChangedListener
> >
> b=uiHnFQ/OI6ffgtiEOG3tJasR/b3KIloGE0HVZIA/gXjDXV5uj+brPkcfAA1+oua/vOI4od
> >
> r6PVJv/WBc9KI6BmuIpaX89n48F32n/eWZylcJ6jCZ3joEMg1XLwoFt0CH5NV3gbN2tbhjly
> > fvLRq38xG16WMYpPTuTxQSvd/eCkE= b=e8e1XF
> >
> > that guy deliveres the event later. (custom event)
> >
> > Regards,
> > Matthias
> >
> > On 6/13/06, David Boyd wrote:
> >
> >>But then you have the problem where the setter methods are called
> >
> > after
> >
> >>valueChanged code
> >>
> >>i.e
> >>
> >>Any variables in your beans you change in your valueChanged methods
> >
> > will
> >
> >>be overwritten by your setter methods
> >>
> >>
> >>This is a common problem
> >>
> >>Just check out
> >>
> >>http://www.irian.at/myfaces-sandbox/valueChangeNotifier.jsf
> >>
> >>There is even a component to overcome the deficiencies in value
> >
> > Changed
> >
> >>methods
> >>
> >>I am more curious to know why this happens? I have a found solutions
> >
> > to
> >
> >>fix this problem e.g sandbox valueChangeNoifier
> >>
> >>
> >>
> >>
> >>
> >>-----Original Message-----
> >>From: mwessendorf@gmail.com [mailto:mwessendorf@gmail.com] On Behalf
> >
> > Of
> >
> >>Matthias Wessendorf
> >>Sent: Wednesday, June 14, 2006 2:50 PM
> >>To: MyFaces Discussion
> >>Subject: [SPAM] Re: inputText not updating from valueChangedListener
> >>
> >
> >
> b=uiHnFQ/OI6ffgtiEOG3tJasR/b3KIloGE0HVZIA/gXjDXV5uj+brPkcfAA1+oua/vOI4od
> >
> >
> r6PVJv/WBc9KI6BmuIpaX89n48F32n/eWZylcJ6jCZ3joEMg1XLwoFt0CH5NV3gbN2tbhjly
> >
> >>fvLRq38xG16WMYpPTuTxQSvd/eCkE=
> >>
> >>have you tried without responsecomplete() ?
> >>
> >>On 6/13/06, David Boyd wrote:
> >>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>Hey all,
> >>>
> >>>
> >>>
> >>>I know this problem most likely would have been addressed before but
> >>
> >>was
> >>
> >>>just wondering if there has been any solution for it?
> >>>
> >>>
> >>>
> >>>Say you had
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> onchange="submit();"
> >>>
> >>> valueChangeListener="#{bean.changedMethod}">
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>and you have the value change method
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>private userName;
> >>>
> >>>//getters and setters for userName
> >>>
> >>>
> >>>
> >>>public void changedMethod(ValueChangeEvent event)
> >>>
> >>> {
> >>>
> >>> userName = "someValue";
> >>>
> >>> FacesContext.getCurrentInstance().renderResponse();
> >>>
> >>> }
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>Just wondering why does the outputText update but the inputText does
> >>
> >>not?
> >>
> >>>i.e why does the outputText display "someValue" and the inputText is
> >>
> >>still
> >>
> >>>empty?
> >>>
> >>>
> >>>
> >>>I know if you bind the inputText and call the setSubmittedValue()
> >
> > you
> >
> >>can
> >>
> >>>update the inputText
> >>>
> >>>
> >>>
> >>>Just wondering if I can get an explanation of why this problem
> >
> > occurs?
> >
> >>>
> >>>
> >>>
> >>
> >>--
> >>Matthias Wessendorf
> >>Aechterhoek 18
> >>48282 Emsdetten
> >>blog: http://jroller.com/page/mwessendorf
> >>mail: mwessendorf-at-gmail-dot-com
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >
> >
> >
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Re: inputText not updating from valueChangedListener b=uiHnFQ/OI6ffgtiEOG3tJasR/b3KIloGE0HVZIA/gXjDXV5uj+brPkcfAA1+oua/vOI4odr6PVJv/WBc9KI6BmuIpaX89n48F32n/eWZylcJ6jCZ3joEMg1XLwoFt0CH5NV3gbN2tbhjlyfvLRq38xG16WMYpPTuTxQSvd/eCkE=
b=e8
Posted by Jeff Bischoff <jb...@klkurz.com>.
Meghana,
Can you go into a little more detail about what you were trying to do,
how it didn't work, and how you solved it? If it is something that
others may run into, then we should update the wiki page to include it. :)
Regards,
Jeff Bischoff
Kenneth L Kurz & Assoc, Inc.
Meghana wrote:
> The link to ClearInputComponents works like a charm. Just one
> modification though. It was resetting the changed field value to the old
> value. So I had to do call its setter from the change value method
> before calling renderResponse().
>
> Hope it helps,
> -M
>
> */Jeff Bischoff <jb...@klkurz.com>/* wrote:
>
> I had a similar problem in the last few days, and someone pointed me to
> this wiki page (which has some alternative solutions compared to the
> link you posted) [1]
>
> As for why...?
>
> [1] http://wiki.apache.org/myfaces/ClearInputComponents
>
> David Boyd wrote:
> > :) I know how the component works assuming he just queues the
> > valueChangedEvent
> >
> > I have blogged alternate solutions as well
> >
> >
> http://java-server-faces.blogspot.com/2006/04/valuechangelisteners-what-
> > you-need-to.html
> >
> > but what I want to know is why?
> >
> > Why does this happen is it a bug? An error in the specification etc?
> >
> > Why does it update for output components and not for input
> components?
> > :)
> >
> >
> >
> >
> >
> >
> > -----Original Message-----
> > From: mwessendorf@gmail.com [mailto:mwessendorf@gmail.com] On
> Behalf Of
> > Matthias Wessendorf
> > Sent: Wednesday, June 14, 2006 3:19 PM
> > To: MyFaces Discussion
> > Subject: [SPAM] Re: Re: inputText not updating from
> valueChangedListener
> >
> b=uiHnFQ/OI6ffgtiEOG3tJasR/b3KIloGE0HVZIA/gXjDXV5uj+brPkcfAA1+oua/vOI4od
> >
> r6PVJv/WBc9KI6BmuIpaX89n48F32n/eWZylcJ6jCZ3joEMg1XLwoFt0CH5NV3gbN2tbhjly
> > fvLRq38xG16WMYpPTuTxQSvd/eCkE= b=e8e1XF
> >
> > that guy deliveres the event later. (custom event)
> >
> > Regards,
> > Matthias
> >
> > On 6/13/06, David Boyd wrote:
> >
> >>But then you have the problem where the setter methods are called
> >
> > after
> >
> >>valueChanged code
> >>
> >>i.e
> >>
> >>Any variables in your beans you change in your valueChanged methods
> >
> > will
> >
> >>be overwritten by your setter methods
> >>
> >>
> >>This is a common problem
> >>
> >>Just check out
> >>
> >>http://www.irian.at/myfaces-sandbox/valueChangeNotifier.jsf
> >>
> >>There is even a component to overcome the deficiencies in value
> >
> > Changed
> >
> >>methods
> >>
> >>I am more curious to know why this happens? I have a found solutions
> >
> > to
> >
> >>fix this problem e.g sandbox valueChangeNoifier
> >>
> >>
> >>
> >>
> >>
> >>-----Original Message-----
> >>From: mwessendorf@gmail.com [mailto:mwessendorf@gmail.com] On Behalf
> >
> > Of
> >
> >>Matthias Wessendorf
> >>Sent: Wednesday, June 14, 2006 2:50 PM
> >>To: MyFaces Discussion
> >>Subject: [SPAM] Re: inputText not updating from valueChangedListener
> >>
> >
> >
> b=uiHnFQ/OI6ffgtiEOG3tJasR/b3KIloGE0HVZIA/gXjDXV5uj+brPkcfAA1+oua/vOI4od
> >
> >
> r6PVJv/WBc9KI6BmuIpaX89n48F32n/eWZylcJ6jCZ3joEMg1XLwoFt0CH5NV3gbN2tbhjly
> >
> >>fvLRq38xG16WMYpPTuTxQSvd/eCkE=
> >>
> >>have you tried without responsecomplete() ?
> >>
> >>On 6/13/06, David Boyd wrote:
> >>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>Hey all,
> >>>
> >>>
> >>>
> >>>I know this problem most likely would have been addressed before but
> >>
> >>was
> >>
> >>>just wondering if there has been any solution for it?
> >>>
> >>>
> >>>
> >>>Say you had
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> onchange="submit();"
> >>>
> >>> valueChangeListener="#{bean.changedMethod}">
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>and you have the value change method
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>private userName;
> >>>
> >>>//getters and setters for userName
> >>>
> >>>
> >>>
> >>>public void changedMethod(ValueChangeEvent event)
> >>>
> >>> {
> >>>
> >>> userName = "someValue";
> >>>
> >>> FacesContext.getCurrentInstance().renderResponse();
> >>>
> >>> }
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>Just wondering why does the outputText update but the inputText does
> >>
> >>not?
> >>
> >>>i.e why does the outputText display "someValue" and the inputText is
> >>
> >>still
> >>
> >>>empty?
> >>>
> >>>
> >>>
> >>>I know if you bind the inputText and call the setSubmittedValue()
> >
> > you
> >
> >>can
> >>
> >>>update the inputText
> >>>
> >>>
> >>>
> >>>Just wondering if I can get an explanation of why this problem
> >
> > occurs?
> >
> >>>
> >>>
> >>>
> >>
> >>--
> >>Matthias Wessendorf
> >>Aechterhoek 18
> >>48282 Emsdetten
> >>blog: http://jroller.com/page/mwessendorf
> >>mail: mwessendorf-at-gmail-dot-com
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >
> >
> >
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
Re: inputText not updating from valueChangedListener b=uiHnFQ/OI6ffgtiEOG3tJasR/b3KIloGE0HVZIA/gXjDXV5uj+brPkcfAA1+oua/vOI4odr6PVJv/WBc9KI6BmuIpaX89n48F32n/eWZylcJ6jCZ3joEMg1XLwoFt0CH5NV3gbN2tbhjlyfvLRq38xG16WMYpPTuTxQSvd/eCkE= b=e8
Posted by Meghana <sy...@yahoo.com>.
The link to ClearInputComponents works like a charm. Just one modification though. It was resetting the changed field value to the old value. So I had to do call its setter from the change value method before calling renderResponse().
Hope it helps,
-M
Jeff Bischoff <jb...@klkurz.com> wrote: I had a similar problem in the last few days, and someone pointed me to
this wiki page (which has some alternative solutions compared to the
link you posted) [1]
As for why...?
[1] http://wiki.apache.org/myfaces/ClearInputComponents
David Boyd wrote:
> :) I know how the component works assuming he just queues the
> valueChangedEvent
>
> I have blogged alternate solutions as well
>
> http://java-server-faces.blogspot.com/2006/04/valuechangelisteners-what-
> you-need-to.html
>
> but what I want to know is why?
>
> Why does this happen is it a bug? An error in the specification etc?
>
> Why does it update for output components and not for input components?
> :)
>
>
>
>
>
>
> -----Original Message-----
> From: mwessendorf@gmail.com [mailto:mwessendorf@gmail.com] On Behalf Of
> Matthias Wessendorf
> Sent: Wednesday, June 14, 2006 3:19 PM
> To: MyFaces Discussion
> Subject: [SPAM] Re: Re: inputText not updating from valueChangedListener
> b=uiHnFQ/OI6ffgtiEOG3tJasR/b3KIloGE0HVZIA/gXjDXV5uj+brPkcfAA1+oua/vOI4od
> r6PVJv/WBc9KI6BmuIpaX89n48F32n/eWZylcJ6jCZ3joEMg1XLwoFt0CH5NV3gbN2tbhjly
> fvLRq38xG16WMYpPTuTxQSvd/eCkE= b=e8e1XF
>
> that guy deliveres the event later. (custom event)
>
> Regards,
> Matthias
>
> On 6/13/06, David Boyd wrote:
>
>>But then you have the problem where the setter methods are called
>
> after
>
>>valueChanged code
>>
>>i.e
>>
>>Any variables in your beans you change in your valueChanged methods
>
> will
>
>>be overwritten by your setter methods
>>
>>
>>This is a common problem
>>
>>Just check out
>>
>>http://www.irian.at/myfaces-sandbox/valueChangeNotifier.jsf
>>
>>There is even a component to overcome the deficiencies in value
>
> Changed
>
>>methods
>>
>>I am more curious to know why this happens? I have a found solutions
>
> to
>
>>fix this problem e.g sandbox valueChangeNoifier
>>
>>
>>
>>
>>
>>-----Original Message-----
>>From: mwessendorf@gmail.com [mailto:mwessendorf@gmail.com] On Behalf
>
> Of
>
>>Matthias Wessendorf
>>Sent: Wednesday, June 14, 2006 2:50 PM
>>To: MyFaces Discussion
>>Subject: [SPAM] Re: inputText not updating from valueChangedListener
>>
>
> b=uiHnFQ/OI6ffgtiEOG3tJasR/b3KIloGE0HVZIA/gXjDXV5uj+brPkcfAA1+oua/vOI4od
>
> r6PVJv/WBc9KI6BmuIpaX89n48F32n/eWZylcJ6jCZ3joEMg1XLwoFt0CH5NV3gbN2tbhjly
>
>>fvLRq38xG16WMYpPTuTxQSvd/eCkE=
>>
>>have you tried without responsecomplete() ?
>>
>>On 6/13/06, David Boyd wrote:
>>
>>>
>>>
>>>
>>>
>>>
>>>Hey all,
>>>
>>>
>>>
>>>I know this problem most likely would have been addressed before but
>>
>>was
>>
>>>just wondering if there has been any solution for it?
>>>
>>>
>>>
>>>Say you had
>>>
>>>
>>>
>>>
>>>
>>> onchange="submit();"
>>>
>>> valueChangeListener="#{bean.changedMethod}">
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>and you have the value change method
>>>
>>>
>>>
>>>
>>>
>>>private userName;
>>>
>>>//getters and setters for userName
>>>
>>>
>>>
>>>public void changedMethod(ValueChangeEvent event)
>>>
>>> {
>>>
>>> userName = "someValue";
>>>
>>> FacesContext.getCurrentInstance().renderResponse();
>>>
>>> }
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>Just wondering why does the outputText update but the inputText does
>>
>>not?
>>
>>>i.e why does the outputText display "someValue" and the inputText is
>>
>>still
>>
>>>empty?
>>>
>>>
>>>
>>>I know if you bind the inputText and call the setSubmittedValue()
>
> you
>
>>can
>>
>>>update the inputText
>>>
>>>
>>>
>>>Just wondering if I can get an explanation of why this problem
>
> occurs?
>
>>>
>>>
>>>
>>
>>--
>>Matthias Wessendorf
>>Aechterhoek 18
>>48282 Emsdetten
>>blog: http://jroller.com/page/mwessendorf
>>mail: mwessendorf-at-gmail-dot-com
>>
>>
>>
>>
>>
>>
>>
>
>
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Re: inputText not updating from valueChangedListener b=uiHnFQ/OI6ffgtiEOG3tJasR/b3KIloGE0HVZIA/gXjDXV5uj+brPkcfAA1+oua/vOI4odr6PVJv/WBc9KI6BmuIpaX89n48F32n/eWZylcJ6jCZ3joEMg1XLwoFt0CH5NV3gbN2tbhjlyfvLRq38xG16WMYpPTuTxQSvd/eCkE=
b=e8
Posted by Jeff Bischoff <jb...@klkurz.com>.
I had a similar problem in the last few days, and someone pointed me to
this wiki page (which has some alternative solutions compared to the
link you posted) [1]
As for why...?
[1] http://wiki.apache.org/myfaces/ClearInputComponents
David Boyd wrote:
> :) I know how the component works assuming he just queues the
> valueChangedEvent
>
> I have blogged alternate solutions as well
>
> http://java-server-faces.blogspot.com/2006/04/valuechangelisteners-what-
> you-need-to.html
>
> but what I want to know is why?
>
> Why does this happen is it a bug? An error in the specification etc?
>
> Why does it update for output components and not for input components?
> :)
>
>
>
>
>
>
> -----Original Message-----
> From: mwessendorf@gmail.com [mailto:mwessendorf@gmail.com] On Behalf Of
> Matthias Wessendorf
> Sent: Wednesday, June 14, 2006 3:19 PM
> To: MyFaces Discussion
> Subject: [SPAM] Re: Re: inputText not updating from valueChangedListener
> b=uiHnFQ/OI6ffgtiEOG3tJasR/b3KIloGE0HVZIA/gXjDXV5uj+brPkcfAA1+oua/vOI4od
> r6PVJv/WBc9KI6BmuIpaX89n48F32n/eWZylcJ6jCZ3joEMg1XLwoFt0CH5NV3gbN2tbhjly
> fvLRq38xG16WMYpPTuTxQSvd/eCkE= b=e8e1XF
>
> that guy deliveres the event later. (custom event)
>
> Regards,
> Matthias
>
> On 6/13/06, David Boyd <db...@indauto.com.au> wrote:
>
>>But then you have the problem where the setter methods are called
>
> after
>
>>valueChanged code
>>
>>i.e
>>
>>Any variables in your beans you change in your valueChanged methods
>
> will
>
>>be overwritten by your setter methods
>>
>>
>>This is a common problem
>>
>>Just check out
>>
>>http://www.irian.at/myfaces-sandbox/valueChangeNotifier.jsf
>>
>>There is even a component to overcome the deficiencies in value
>
> Changed
>
>>methods
>>
>>I am more curious to know why this happens? I have a found solutions
>
> to
>
>>fix this problem e.g sandbox valueChangeNoifier
>>
>>
>>
>>
>>
>>-----Original Message-----
>>From: mwessendorf@gmail.com [mailto:mwessendorf@gmail.com] On Behalf
>
> Of
>
>>Matthias Wessendorf
>>Sent: Wednesday, June 14, 2006 2:50 PM
>>To: MyFaces Discussion
>>Subject: [SPAM] Re: inputText not updating from valueChangedListener
>>
>
> b=uiHnFQ/OI6ffgtiEOG3tJasR/b3KIloGE0HVZIA/gXjDXV5uj+brPkcfAA1+oua/vOI4od
>
> r6PVJv/WBc9KI6BmuIpaX89n48F32n/eWZylcJ6jCZ3joEMg1XLwoFt0CH5NV3gbN2tbhjly
>
>>fvLRq38xG16WMYpPTuTxQSvd/eCkE=
>>
>>have you tried without responsecomplete() ?
>>
>>On 6/13/06, David Boyd <db...@indauto.com.au> wrote:
>>
>>>
>>>
>>>
>>>
>>>
>>>Hey all,
>>>
>>>
>>>
>>>I know this problem most likely would have been addressed before but
>>
>>was
>>
>>>just wondering if there has been any solution for it?
>>>
>>>
>>>
>>>Say you had
>>>
>>>
>>>
>>><t:selectOneMenu value="#{bean.test}"
>>>
>>> onchange="submit();"
>>>
>>> valueChangeListener="#{bean.changedMethod}">
>>>
>>> <f:selectItem itemValue="a" itemLabel="a"/>
>>>
>>> <f:selectItem itemValue="b" itemLabel="b"/>
>>>
>>></t:selectOneMenu>
>>>
>>>
>>>
>>><t:inputText value="#{bean.userName}" />
>>>
>>><t:outputText " value="#{bean.userName}" />
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>and you have the value change method
>>>
>>>
>>>
>>>
>>>
>>>private userName;
>>>
>>>//getters and setters for userName
>>>
>>>
>>>
>>>public void changedMethod(ValueChangeEvent event)
>>>
>>> {
>>>
>>> userName = "someValue";
>>>
>>> FacesContext.getCurrentInstance().renderResponse();
>>>
>>> }
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>Just wondering why does the outputText update but the inputText does
>>
>>not?
>>
>>>i.e why does the outputText display "someValue" and the inputText is
>>
>>still
>>
>>>empty?
>>>
>>>
>>>
>>>I know if you bind the inputText and call the setSubmittedValue()
>
> you
>
>>can
>>
>>>update the inputText
>>>
>>>
>>>
>>>Just wondering if I can get an explanation of why this problem
>
> occurs?
>
>>>
>>>
>>>
>>
>>--
>>Matthias Wessendorf
>>Aechterhoek 18
>>48282 Emsdetten
>>blog: http://jroller.com/page/mwessendorf
>>mail: mwessendorf-at-gmail-dot-com
>>
>>
>>
>>
>>
>>
>>
>
>
>