List Info

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




how deeply into a bean does myfaces update value references?
user name
2006-07-31 22:53:35

Craig, is there any thought to add namespace support to the EL? Example:

 

#{myBean.blah}

 

As opposed to:

 

#{myModule:myBean}

 

This would help greatly, especially for those of us who have huge numbers of managed beans.

Or the more adventurous of us who want to try (or need) and delegate some DI to spring or hivemind. ;)

 


From: craigmccgmail.com [mailto:craigmccgmail.com] On Behalf Of Craig McClanahan
Sent: Tuesday, 1 August 2006 7:50 AM
To: MyFaces Discussion
Subject: Re: how deeply into a bean does myfaces update value references?

 

 

On 7/31/06, Andrew Robinson <gmail.com">andrew.rw.robinsongmail.com> wrote:

It should never look for (or set) "myBean.myBean&quot; 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&quot; 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, putnam.com">Thomas_Perryputnam.com <putnam.com">Thomas_Perryputnam.com> wrote:
>
&gt;
>
&gt;
>
>
> Andrew,
&gt;
> would myfaces also find the property 'MyBean mybean'&nbsp; which is defined in
> MyBean and call
> setFoo on that reference?
>
>; for example, I've got
>
> MyBean class
>; &nbsp; &nbsp; &nbsp; private String foo &nbsp;(with getters and setters)
> &nbsp;   ;  private MyBean myBean (with getters and setters
>
&gt; before the update page renders, I save a copy of MyBean in itself.
&gt;
> so the MyBean copy also has a foo reference.
>
>; what it looks like is that when the page is submitted, myfaces updates the
> visible
&gt; foo property but also find the foo property in the 'MyBean myBean'
&gt; 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.
&gt;
> Thank you for the response.
> Tom
>
>
>
>
>; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &quot;Andrew Robinson&quot;
>&nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp;<andrew.rw.robins
>&nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp;gmail.com">ongmail.com ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; To
> &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp;"MyFaces Discussion"
&gt; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; 07/31/2006 02:07 &nbsp; &nbsp;   ; &nbsp; <;myfaces.apache.org"> usersmyfaces.apache.org&gt;
>&nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp;PM ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; cc
>
  ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;  Subject
>&nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp;Please respond to &nbsp; &nbsp;   ;  Re: how deeply into a bean does
>&nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;"MyFaces&nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp;myfaces update value references?
>&nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; Discussion"
  ; &nbsp; &nbsp; &nbsp; &nbsp;   ;<myfaces.ap">usersmyfaces.ap
>&nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp; ache.org&gt;
>
>
>
>
>
>
>;
> <h:inputText  value="#{myBean.foo}&quot;
>
> On update:
&gt; Look for "myBean" in the scoped maps (request, session, application).
>
&gt; If not found, create a new instance of mybean.
&gt; call setFoo() on the instance of my bean.
>;
> On 7/31/06, putnam.com">Thomas_Perryputnam.com <putnam.com"> Thomas_Perryputnam.com> wrote:
> >
> >
> >
> >
> >
> > hello everyone,
> >
> > I have a jsp and backing bean. ; The jsp has a field like
> > <h:inputText  value="#{ myBean.foo}"
&gt; >
> > MyBean.java has the "foo&quot; property, and it also has a property like
> >
>  ; &nbsp;  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? &nbsp;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.&nbsp;  All market prices, data and
> other information are not warranted as to completeness or accuracy and are
> subject to change without notice.&nbsp; Any comments or statements made herein
> do not necessarily reflect those of Putnam, LLC (DBA Putnam Investments)
> and its subsidiaries and affiliates. &nbsp;If you are not the intended recipient
> of this e-mail, please delete the e-mail.
&gt; >
>
>
>;
>
&gt;
> 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. &nbsp;Putnam does not accept purchase or redemptions of securities, instructions, or authorizations that are sent via e-mail.&nbsp;  All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice.&nbsp; Any comments or statements made herein do not necessarily reflect those of Putnam, LLC (DBA Putnam Investments) and its subsidiaries and affiliates. &nbsp;If you are not the intended recipient of this e-mail, please delete the e-mail.
>

 

how deeply into a bean does myfaces update value references?
user name
2006-07-31 23:21:19


On 7/31/06, Dhananjay Prasanna <emergency.qld.gov.au">dprasannaemergency.qld.gov.au> wrote:

Craig, is there any thought to add namespace support to the EL? Example:

 

#{myBean.blah}

 

As opposed to:

 

#{myModule:myBean}

 

This would help greatly, especially for those of us who have huge numbers of managed beans.


There is no special support for "namespaces"; in JSF 1.2 (the most recent finalized spec), but nothing really stops you from simulating this. ; I tend to use "$&quot; instead of ":&quot; as a separator, because it is a legal character in identifiers so you don't have to go quoting things.

Or the more adventurous of us who want to try (or need) and delegate some DI to spring or hivemind. ;)


I don't know of any Hivemind integration, but it's already there for Spring.&nbsp; In 1.2.5 they started offering a custom variable resolver that can use Spring to create singletons or a new bean on each request -- and it happens transparently to your usage of value binding and method binding expressions.  In Spring 2, the story is even better since they've added the concept of scopes, so you can tell Spring to create a new session scoped bean. ; From the JSF perspective, you just use expressions like you always have ... it's just that Spring will be used instead of managed beans to construct and return the instances.

Craig


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )