That's funny. I'm doing the exact same thing in my 3.0-Apps and it works
very well. The only difference I can see is that I call
super.prepareForRender() first. Perhaps you could try this.
hth
Marcus

> -----Original Message-----
> From: Jacob von Eyben [mailto:[EMAIL PROTECTED]
> Sent: Thursday, January 12, 2006 12:53 PM
> To: [email protected]
> Subject: 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to