You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Th...@putnam.com on 2006/07/31 19:59:23 UTC

how deeply into a bean does myfaces update value references?





hello everyone,

I have a jsp and backing bean.  The jsp has a field like
<h:inputText  value="#{myBean.foo}"

MyBean.java has the "foo" property, and it also has a property like

      private MyBean myBean = null;
 with getters and setters

I save a copy of MyBean here before any update so I can reset or cancel
the update as needed, and restore the original MyBean to session.

I find if I enter something in the foo field of the jsp, the foo property
in the
saved original untouched MyBean property is also updated.

Does my faces search a backing bean for all references to a property
and update all references?  That's what it looks like it's doing, but is
that what
you see?

Thanks in advance for your help.
Tom



 
This message is intended for the recipient only and is not meant to be forwarded or distributed in any other format. This communication is for informational purposes only.  It is not intended as an offer or solicitation for the purchase or sale of any financial instrument, or security, or as an official confirmation of any transaction.  Putnam does not accept purchase or redemptions of securities, instructions, or authorizations that are sent via e-mail.   All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice.  Any comments or statements made herein do not necessarily reflect those of Putnam, LLC (DBA Putnam Investments) and its subsidiaries and affiliates.  If you are not the intended recipient of this e-mail, please delete the e-mail.

Re: how deeply into a bean does myfaces update value references?

Posted by Craig McClanahan <cr...@apache.org>.
On 7/31/06, Andrew Robinson <an...@gmail.com> wrote:
>
> It should never look for (or set) "myBean.myBean" unless you use it
> somewhere in the EL or have it as a managed property in the faces
> config. What code (including EL and managed properties) refers to the
> "myBean" property?


To be more specific, here are a couple of example expressions and what they
reference:

#{myBean.foo} references the foo property in the "outer" MyBean instance.

#{myBean.mybean.foo} references the foo property in the "inner" MyBean
instance.

In other words, evaluation just follows the path you explicitly specify ...
the last element represents the property whose value is updated.

Craig


On 7/31/06, Thomas_Perry@putnam.com <Th...@putnam.com> wrote:
> >
> >
> >
> >
> >
> >
> > Andrew,
> >
> > would myfaces also find the property 'MyBean mybean'  which is defined
> in
> > MyBean and call
> > setFoo on that reference?
> >
> > for example, I've got
> >
> > MyBean class
> >       private String foo  (with getters and setters)
> >       private MyBean myBean (with getters and setters
> >
> > before the update page renders, I save a copy of MyBean in itself.
> >
> > so the MyBean copy also has a foo reference.
> >
> > what it looks like is that when the page is submitted, myfaces updates
> the
> > visible
> > foo property but also find the foo property in the 'MyBean myBean'
> > property.
> >
> > does that make sense? and is that the intended behavior of Myfaces?
> >
> > I'm keeping a copy of the bean in itself to be able to reset the update
> > form.
> >
> > I know a Reset button of type=reset works, but on this page there are
> lists
> > which could cause a form submit and I can't reset the update form to
> > the original state.
> >
> > Thank you for the response.
> > Tom
> >
> >
> >
> >
> >              "Andrew Robinson"
> >              <andrew.rw.robins
> >              on@gmail.com
> >                                              To
> >                                        "MyFaces Discussion"
> >              07/31/2006 02:07          <us...@myfaces.apache.org>
> >              PM
> cc
> >
>
> >                                                                    Subject
> >              Please respond to         Re: how deeply into a bean does
> >                  "MyFaces              myfaces update value references?
> >                 Discussion"
> >              <users@myfaces.ap
> >                  ache.org>
> >
> >
> >
> >
> >
> >
> >
> > <h:inputText  value="#{myBean.foo}"
> >
> > On update:
> > Look for "myBean" in the scoped maps (request, session, application).
> >
> > If not found, create a new instance of mybean.
> > call setFoo() on the instance of my bean.
> >
> > On 7/31/06, Thomas_Perry@putnam.com <Th...@putnam.com> wrote:
> > >
> > >
> > >
> > >
> > >
> > > hello everyone,
> > >
> > > I have a jsp and backing bean.  The jsp has a field like
> > > <h:inputText  value="#{myBean.foo}"
> > >
> > > MyBean.java has the "foo" property, and it also has a property like
> > >
> > >       private MyBean myBean = null;
> > >  with getters and setters
> > >
> > > I save a copy of MyBean here before any update so I can reset or
> cancel
> > > the update as needed, and restore the original MyBean to session.
> > >
> > > I find if I enter something in the foo field of the jsp, the foo
> property
> > > in the
> > > saved original untouched MyBean property is also updated.
> > >
> > > Does my faces search a backing bean for all references to a property
> > > and update all references?  That's what it looks like it's doing, but
> is
> > > that what
> > > you see?
> > >
> > > Thanks in advance for your help.
> > > Tom
> > >
> > >
> > >
> > >
> > > This message is intended for the recipient only and is not meant to be
> > forwarded or distributed in any other format. This communication is for
> > informational purposes only.  It is not intended as an offer or
> > solicitation for the purchase or sale of any financial instrument, or
> > security, or as an official confirmation of any transaction.  Putnam
> does
> > not accept purchase or redemptions of securities, instructions, or
> > authorizations that are sent via e-mail.   All market prices, data and
> > other information are not warranted as to completeness or accuracy and
> are
> > subject to change without notice.  Any comments or statements made
> herein
> > do not necessarily reflect those of Putnam, LLC (DBA Putnam Investments)
> > and its subsidiaries and affiliates.  If you are not the intended
> recipient
> > of this e-mail, please delete the e-mail.
> > >
> >
> >
> >
> >
> >
> > This message is intended for the recipient only and is not meant to be
> forwarded or distributed in any other format. This communication is for
> informational purposes only.  It is not intended as an offer or solicitation
> for the purchase or sale of any financial instrument, or security, or as an
> official confirmation of any transaction.  Putnam does not accept purchase
> or redemptions of securities, instructions, or authorizations that are sent
> via e-mail.   All market prices, data and other information are not
> warranted as to completeness or accuracy and are subject to change without
> notice.  Any comments or statements made herein do not necessarily reflect
> those of Putnam, LLC (DBA Putnam Investments) and its subsidiaries and
> affiliates.  If you are not the intended recipient of this e-mail, please
> delete the e-mail.
> >
>

Re: how deeply into a bean does myfaces update value references?

Posted by Andrew Robinson <an...@gmail.com>.
It should never look for (or set) "myBean.myBean" unless you use it
somewhere in the EL or have it as a managed property in the faces
config. What code (including EL and managed properties) refers to the
"myBean" property?

On 7/31/06, Thomas_Perry@putnam.com <Th...@putnam.com> wrote:
>
>
>
>
>
>
> Andrew,
>
> would myfaces also find the property 'MyBean mybean'  which is defined in
> MyBean and call
> setFoo on that reference?
>
> for example, I've got
>
> MyBean class
>       private String foo  (with getters and setters)
>       private MyBean myBean (with getters and setters
>
> before the update page renders, I save a copy of MyBean in itself.
>
> so the MyBean copy also has a foo reference.
>
> what it looks like is that when the page is submitted, myfaces updates the
> visible
> foo property but also find the foo property in the 'MyBean myBean'
> property.
>
> does that make sense? and is that the intended behavior of Myfaces?
>
> I'm keeping a copy of the bean in itself to be able to reset the update
> form.
>
> I know a Reset button of type=reset works, but on this page there are lists
> which could cause a form submit and I can't reset the update form to
> the original state.
>
> Thank you for the response.
> Tom
>
>
>
>
>              "Andrew Robinson"
>              <andrew.rw.robins
>              on@gmail.com>                                              To
>                                        "MyFaces Discussion"
>              07/31/2006 02:07          <us...@myfaces.apache.org>
>              PM                                                         cc
>
>                                                                    Subject
>              Please respond to         Re: how deeply into a bean does
>                  "MyFaces              myfaces update value references?
>                 Discussion"
>              <users@myfaces.ap
>                  ache.org>
>
>
>
>
>
>
>
> <h:inputText  value="#{myBean.foo}"
>
> On update:
> Look for "myBean" in the scoped maps (request, session, application).
>
> If not found, create a new instance of mybean.
> call setFoo() on the instance of my bean.
>
> On 7/31/06, Thomas_Perry@putnam.com <Th...@putnam.com> wrote:
> >
> >
> >
> >
> >
> > hello everyone,
> >
> > I have a jsp and backing bean.  The jsp has a field like
> > <h:inputText  value="#{myBean.foo}"
> >
> > MyBean.java has the "foo" property, and it also has a property like
> >
> >       private MyBean myBean = null;
> >  with getters and setters
> >
> > I save a copy of MyBean here before any update so I can reset or cancel
> > the update as needed, and restore the original MyBean to session.
> >
> > I find if I enter something in the foo field of the jsp, the foo property
> > in the
> > saved original untouched MyBean property is also updated.
> >
> > Does my faces search a backing bean for all references to a property
> > and update all references?  That's what it looks like it's doing, but is
> > that what
> > you see?
> >
> > Thanks in advance for your help.
> > Tom
> >
> >
> >
> >
> > This message is intended for the recipient only and is not meant to be
> forwarded or distributed in any other format. This communication is for
> informational purposes only.  It is not intended as an offer or
> solicitation for the purchase or sale of any financial instrument, or
> security, or as an official confirmation of any transaction.  Putnam does
> not accept purchase or redemptions of securities, instructions, or
> authorizations that are sent via e-mail.   All market prices, data and
> other information are not warranted as to completeness or accuracy and are
> subject to change without notice.  Any comments or statements made herein
> do not necessarily reflect those of Putnam, LLC (DBA Putnam Investments)
> and its subsidiaries and affiliates.  If you are not the intended recipient
> of this e-mail, please delete the e-mail.
> >
>
>
>
>
>
> This message is intended for the recipient only and is not meant to be forwarded or distributed in any other format. This communication is for informational purposes only.  It is not intended as an offer or solicitation for the purchase or sale of any financial instrument, or security, or as an official confirmation of any transaction.  Putnam does not accept purchase or redemptions of securities, instructions, or authorizations that are sent via e-mail.   All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice.  Any comments or statements made herein do not necessarily reflect those of Putnam, LLC (DBA Putnam Investments) and its subsidiaries and affiliates.  If you are not the intended recipient of this e-mail, please delete the e-mail.
>

Re: how deeply into a bean does myfaces update value references?

Posted by Th...@putnam.com.





Andrew,

would myfaces also find the property 'MyBean mybean'  which is defined in
MyBean and call
setFoo on that reference?

for example, I've got

MyBean class
      private String foo  (with getters and setters)
      private MyBean myBean (with getters and setters

before the update page renders, I save a copy of MyBean in itself.

so the MyBean copy also has a foo reference.

what it looks like is that when the page is submitted, myfaces updates the
visible
foo property but also find the foo property in the 'MyBean myBean'
property.

does that make sense? and is that the intended behavior of Myfaces?

I'm keeping a copy of the bean in itself to be able to reset the update
form.

I know a Reset button of type=reset works, but on this page there are lists
which could cause a form submit and I can't reset the update form to
the original state.

Thank you for the response.
Tom



                                                                           
             "Andrew Robinson"                                             
             <andrew.rw.robins                                             
             on@gmail.com>                                              To 
                                       "MyFaces Discussion"                
             07/31/2006 02:07          <us...@myfaces.apache.org>          
             PM                                                         cc 
                                                                           
                                                                   Subject 
             Please respond to         Re: how deeply into a bean does     
                 "MyFaces              myfaces update value references?    
                Discussion"                                                
             <users@myfaces.ap                                             
                 ache.org>                                                 
                                                                           
                                                                           
                                                                           




<h:inputText  value="#{myBean.foo}"

On update:
Look for "myBean" in the scoped maps (request, session, application).

If not found, create a new instance of mybean.
call setFoo() on the instance of my bean.

On 7/31/06, Thomas_Perry@putnam.com <Th...@putnam.com> wrote:
>
>
>
>
>
> hello everyone,
>
> I have a jsp and backing bean.  The jsp has a field like
> <h:inputText  value="#{myBean.foo}"
>
> MyBean.java has the "foo" property, and it also has a property like
>
>       private MyBean myBean = null;
>  with getters and setters
>
> I save a copy of MyBean here before any update so I can reset or cancel
> the update as needed, and restore the original MyBean to session.
>
> I find if I enter something in the foo field of the jsp, the foo property
> in the
> saved original untouched MyBean property is also updated.
>
> Does my faces search a backing bean for all references to a property
> and update all references?  That's what it looks like it's doing, but is
> that what
> you see?
>
> Thanks in advance for your help.
> Tom
>
>
>
>
> This message is intended for the recipient only and is not meant to be
forwarded or distributed in any other format. This communication is for
informational purposes only.  It is not intended as an offer or
solicitation for the purchase or sale of any financial instrument, or
security, or as an official confirmation of any transaction.  Putnam does
not accept purchase or redemptions of securities, instructions, or
authorizations that are sent via e-mail.   All market prices, data and
other information are not warranted as to completeness or accuracy and are
subject to change without notice.  Any comments or statements made herein
do not necessarily reflect those of Putnam, LLC (DBA Putnam Investments)
and its subsidiaries and affiliates.  If you are not the intended recipient
of this e-mail, please delete the e-mail.
>




 
This message is intended for the recipient only and is not meant to be forwarded or distributed in any other format. This communication is for informational purposes only.  It is not intended as an offer or solicitation for the purchase or sale of any financial instrument, or security, or as an official confirmation of any transaction.  Putnam does not accept purchase or redemptions of securities, instructions, or authorizations that are sent via e-mail.   All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice.  Any comments or statements made herein do not necessarily reflect those of Putnam, LLC (DBA Putnam Investments) and its subsidiaries and affiliates.  If you are not the intended recipient of this e-mail, please delete the e-mail.

Re: how deeply into a bean does myfaces update value references?

Posted by Andrew Robinson <an...@gmail.com>.
<h:inputText  value="#{myBean.foo}"

On update:
Look for "myBean" in the scoped maps (request, session, application).

If not found, create a new instance of mybean.
call setFoo() on the instance of my bean.

On 7/31/06, Thomas_Perry@putnam.com <Th...@putnam.com> wrote:
>
>
>
>
>
> hello everyone,
>
> I have a jsp and backing bean.  The jsp has a field like
> <h:inputText  value="#{myBean.foo}"
>
> MyBean.java has the "foo" property, and it also has a property like
>
>       private MyBean myBean = null;
>  with getters and setters
>
> I save a copy of MyBean here before any update so I can reset or cancel
> the update as needed, and restore the original MyBean to session.
>
> I find if I enter something in the foo field of the jsp, the foo property
> in the
> saved original untouched MyBean property is also updated.
>
> Does my faces search a backing bean for all references to a property
> and update all references?  That's what it looks like it's doing, but is
> that what
> you see?
>
> Thanks in advance for your help.
> Tom
>
>
>
>
> This message is intended for the recipient only and is not meant to be forwarded or distributed in any other format. This communication is for informational purposes only.  It is not intended as an offer or solicitation for the purchase or sale of any financial instrument, or security, or as an official confirmation of any transaction.  Putnam does not accept purchase or redemptions of securities, instructions, or authorizations that are sent via e-mail.   All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice.  Any comments or statements made herein do not necessarily reflect those of Putnam, LLC (DBA Putnam Investments) and its subsidiaries and affiliates.  If you are not the intended recipient of this e-mail, please delete the e-mail.
>