On 03/22/2011 05:10 PM, Thiago H. de Paula Figueiredo wrote:
On Tue, 22 Mar 2011 17:53:12 -0300, Rich M <rich...@moremagic.com> wrote:
Okay, maybe I'm not interpreting the page lifecycle properly here, or
it has changed it some way that is causing me problems? The entity is
referenced and loaded properly in onPrepareForRender. Considering
that BeanEditor only changes the value of the edited property if it's
null, then what could be causing the private entity field to become
set to null between onPrepareForRender and the coupling/rendering of
the BeanEditor? I have no direct statements doing as much in my code.
Why don't you use onPrepare() instead of onPrepareForRender()?
Same result, unfortunately. I switched to onPrepareForRender eventually
because onPrepare gets called 2-3 times during the page lifecycle while
onPrepareForRender only once. It didn't break anything back in 5.1.0.15
so it seemed like a good idea. I wanted to avoid extra DB calls and
array/String parsing. On another note, I'm not sure whether this problem
even relates to the @Environmental object at all, but I did figure I'd
mention it before just in case.
Anyway, here is what is happening:
@Property @Persist
private ThirdParty tp;
@Persist @Property
private ThirdParty tp2;
@Persist
private ThirdParty tp3;
public void onPrepare(){
ThirdParty tp = tpdao.read( id.getId() );
// perform field parsing for overridden BeanEditForm blocks
ThirdParty tp2 = tp.clone();
ThirdParty tp3 = tp.clone();
log.debug("In onPrepare: tp = " + tp);
}
public void afterRender(){
log.debug("tp: " + tp + "\n tp2: " + tp2 + "\n tp3: " + tp3);
}
TML:
<t:beaneditform object="tp2">
Results:
In onPrepare: tp = person; name = person
In onPrepare: tp = person; name = person
tp: id = person; name = person
tp2: id = null; name = null
tp3: id = person; name = person
In response to the Environment vs. Component Parameters, these are
all Pages not Components. Actually this structure and exact use was
discussed in this (
http://tapestry.markmail.org/thread/4rffky2r2uqno5ea#query:+page:1+mid:j375h7obo6hd2i6b+state:results
) previous thread.
I remember that. :) Yep, you need the Environment here.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org