You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Eric Everman <ev...@precedadesign.com> on 2003/04/28 23:22:57 UTC

Component Initiation Event

I'm looking for an event I can use to initiate a component for a given 
request.  My usage would be something like this:


-Action, Direct, or External service is used to access parent page, passing 
an ID value and other parameters
*** The Component loads an entity from a db or creates a new entity based 
on parameters***
-properties of the entity are used to render in a form

I tried to use the prepareForRender() method, but this method seems to be 
called after commitChanges(), so it throws an error when I try to alter 
persistent properties.  I also considered lazy creating the entity in the 
getEntity() method, but this seems like a bad design choice, since it might 
cause a persistence layer problem to show up in a ognl property path like 
entity.name.

Am I missing an obvious solution here?


Thanks,

Eric Everman

Preceda Design LLC
www.precedadesign.com

RE: Component Initiation Event

Posted by Eric Everman <ev...@precedadesign.com>.
I just tried using the pageBeginRender() event, but the component's 
parameters (from the .page file) are not yet set when this method is 
called.  As I look at the code for AbstractPage.renderPage(), it looks like 
the entire operation of setting parameters and rendering a component is 
bundled into the render() method, which is after commitPageChanges().

Is there not a definite point at which a component has all of its incoming 
info such as specification parameters, restored persistent state, and 
incoming values from bound form fields (not including dynamic 
properties)?  This would be a great time to initialize things, but I don't 
think I've found it yet.  Am I still missing something?  My usage doesn't 
seem too strange, has anyone else run across the same need?

Thanks again for the help - further ideas would be appreciated.

Eric Everman


At 4/28/2003, you wrote:
>The PageRenderListener interface defines pageBeginRender().  This is invoked
>early, when it is still acceptible to modify persistent page properties.
>
>--
>Howard M. Lewis Ship
>Creator, Tapestry: Java Web Components
>http://jakarta.apache.org/tapestry
>
>
>
> > -----Original Message-----
> > From: Eric Everman [mailto:everman@precedadesign.com]
> > Sent: Monday, April 28, 2003 5:23 PM
> > To: Tapestry users
> > Subject: Component Initiation Event
> >
> >
> > I'm looking for an event I can use to initiate a component
> > for a given
> > request.  My usage would be something like this:
> >
> >
> > -Action, Direct, or External service is used to access parent
> > page, passing
> > an ID value and other parameters
> > *** The Component loads an entity from a db or creates a new
> > entity based
> > on parameters***
> > -properties of the entity are used to render in a form
> >
> > I tried to use the prepareForRender() method, but this method
> > seems to be
> > called after commitChanges(), so it throws an error when I
> > try to alter
> > persistent properties.  I also considered lazy creating the
> > entity in the
> > getEntity() method, but this seems like a bad design choice,
> > since it might
> > cause a persistence layer problem to show up in a ognl
> > property path like
> > entity.name.
> >
> > Am I missing an obvious solution here?
> >
> >
> > Thanks,
> >
> > Eric Everman
> >
> > Preceda Design LLC
> > www.precedadesign.com
> >
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


RE: Component Initiation Event

Posted by "Howard M. Lewis Ship" <hl...@attbi.com>.
The PageRenderListener interface defines pageBeginRender().  This is invoked
early, when it is still acceptible to modify persistent page properties.

--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/tapestry



> -----Original Message-----
> From: Eric Everman [mailto:everman@precedadesign.com] 
> Sent: Monday, April 28, 2003 5:23 PM
> To: Tapestry users
> Subject: Component Initiation Event
> 
> 
> I'm looking for an event I can use to initiate a component 
> for a given 
> request.  My usage would be something like this:
> 
> 
> -Action, Direct, or External service is used to access parent 
> page, passing 
> an ID value and other parameters
> *** The Component loads an entity from a db or creates a new 
> entity based 
> on parameters***
> -properties of the entity are used to render in a form
> 
> I tried to use the prepareForRender() method, but this method 
> seems to be 
> called after commitChanges(), so it throws an error when I 
> try to alter 
> persistent properties.  I also considered lazy creating the 
> entity in the 
> getEntity() method, but this seems like a bad design choice, 
> since it might 
> cause a persistence layer problem to show up in a ognl 
> property path like 
> entity.name.
> 
> Am I missing an obvious solution here?
> 
> 
> Thanks,
> 
> Eric Everman
> 
> Preceda Design LLC
> www.precedadesign.com
> 


RE: Component Initiation Event

Posted by Adam Greene <ag...@romulin.com>.
Possibly beginResponse might be a place to do it.

-----Original Message-----
From: Eric Everman [mailto:everman@precedadesign.com]
Sent: Monday, April 28, 2003 6:23 PM
To: Tapestry users
Subject: Component Initiation Event


I'm looking for an event I can use to initiate a component for a given
request.  My usage would be something like this:


-Action, Direct, or External service is used to access parent page, passing
an ID value and other parameters
*** The Component loads an entity from a db or creates a new entity based
on parameters***
-properties of the entity are used to render in a form

I tried to use the prepareForRender() method, but this method seems to be
called after commitChanges(), so it throws an error when I try to alter
persistent properties.  I also considered lazy creating the entity in the
getEntity() method, but this seems like a bad design choice, since it might
cause a persistence layer problem to show up in a ognl property path like
entity.name.

Am I missing an obvious solution here?


Thanks,

Eric Everman

Preceda Design LLC
www.precedadesign.com