thanks josh, i'll try it out.

On 4/01/2011 11:31 AM, Josh Canfield wrote:
Currently both annotations claim ownership of the field. This prevents
conflicts when managing read/write access. For instance, which annotation
should provide the value for the field if both a persisted value and a
parameter value are available?

I would recommend breaking it into two fields. Note that if your parameter
is bound to a property of the containing component then the getter for that
property will still be called.

Something like this, but compiled and tested which I didn't do!

@Parameter
private String myParameter;

@Persist
private String myCachedParameter;

@Inject
private Request request;

@SetupRender
void storeCachedParameterValue() {
   if ( !request.isXHR() ) myCachedParameter = myParameter;
}

private String getMyParameter() {
   if ( request.isXHR() )
     return myCachedParameter;
   return myParameter;
}

Josh


On Mon, Jan 3, 2011 at 3:40 PM, Paul Stanton<p...@mapshed.com.au>  wrote:

Hi all,

Does anyone know why you can't use do the following:

@Parameter
@Persist
private String myProperty;

?

I want to initialise the value for my component via a parameter and then
have it available for ajax event handlers within the component...

if I can't do the above, what's the recommended approach?

thanks, p.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to