Hmm, interesting. Doesn't seem to work even if I send the object as a context 
parameter, the object is still null in the action method :-/

- hugi




On 9.12.2011, at 12:50, Thiago H. de Paula Figueiredo wrote:

> On Fri, 09 Dec 2011 10:38:07 -0200, Hugi Thordarson <h...@karlmenn.is> wrote:
> 
>> In the component "ObjectLink", I can print the value of currentObject.name. 
>> However, if I use the "object" binding in an action method 
>> (onActionFromSelect) the "object" parameter is always null?
> 
> Because onActionFromSelect() is invoked in another request, so the value of 
> currentObject is lost unless you persist it in some way. In Tapestry 4 your 
> code would work, but T4 had something called the rewind phase that caused 
> worse problems, so T5 doesn't have rewind (yeah!). The recommended solution 
> here is to add context="currentObject" to the ActionLink inside your 
> component and make onActionFromSelect() to receive the context. Something 
> like this:
> 
> <t:actionLink t:id="select" context="object"><t:body /></t:actionLink>
> 
> Object onActionFromSelect(CayenneDataObject object) {
>       Class pageClass = CRUDUtil.detailPageClass( object.getClass() );
>       DetailPage<CayenneDataObject> t = 
> (DetailPage<CayenneDataObject>)componentSource.getPage( pageClass );
>       t.setSelectedObject( object );
>       return t;
> }
> 
> -- 
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and 
> instructor
> Owner, Ars Machina Tecnologia da Informação Ltda.
> http://www.arsmachina.com.br


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

Reply via email to