Hi,

I am implementing a component hence I can't implement the IPageRenderListener - it is only for pages.

Besides I was wrong about the theory having my components sharing some object and being in same namespace. Obviously they are on different pages and by that they have different keys in the sessionRecorder.

I think I have some other (local) problem, because now I have the component working on two different pages, but not on this third _bastard_ of a page :-)

I have to look into the differences on these pages.

Regards
Jacob von Eyben




Schulte Marcus wrote:

Oh, your code is from a component! Sorry, didnt't get this first.
Try implementing PageRenderListener and implement pageBeginRender( PageEvent
event ).
that works for me.

-----Original Message-----
From: Jacob von Eyben [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 12, 2006 1:47 PM
To: Tapestry users
Subject: Re: Howto initializing a persisted property - only once


Hi,

I was wrong when I told that I got the exception everytime. Actually the solution about implementing prepareForRender works on the first page I render that has my component, but the second page that uses the exact same component throws the exception about the page was committed().

I think I have narrowed my problem down to the fact that the same component is used in more than one page. It has the side effect that they are in the same namespace (pagename.componentname combined gives the name), hence they share some set of pagerecorders or other tapestry related objects.

That could be the reason why I have the problem.

Anyone of you ever had a similiar problem? and how did you solve it?

I think I could wrap the use of the component into another component, but that can't be the way to do this, right?

Regards
Jacob von Eyben

Schulte Marcus wrote:

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]



---------------------------------------------------------------------
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]




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

Reply via email to