You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jacob von Eyben <je...@nordija.com> on 2006/01/12 12:52:36 UTC

Howto initializing a persisted property - only once

Hi,

I am struggling a bit with initializing a persisted property of a component

I need something like this:
<property-specification name="userStoryFilter" 
type="com.nordija.planb.domain.util.UserStoryFilter" initial-value="new 
com.nordija.planb.domain.util.UserStoryFilter() " persistent="yes"/>
Except that the effect of initial-value is that it will be initialized 
everytime the page the component is contained inside is put back into 
the page pool.

I need to do a initialize once.

I have tried manually by writing:
protected void prepareForRender(IRequestCycle cycle) {
  if (getUserStoryFilter() == null) {
    setUserStoryFilter(new UserStoryFilter());
  }
  super.prepareForRender(cycle);
}

But it generates a runtimeexception:
Page recorder for page MyPage is locked after a commit(), but received a 
change to property userStoryFilter of component MyPage/myComponent.

Do you have any suggestions on how to initialize a persisted property 
the first time the component is rendered on a specific page?

I'm using Tapestry 3.0.3.

Regards
Jacob von Eyben


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org