tapestry-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tony Nelson <tnel...@starpoint.com>
Subject Re: 5.3-rc-2 Exception
Date Wed, 02 Nov 2011 13:50:02 GMT

On Nov 1, 2011, at 7:29 PM, Thiago H. de Paula Figueiredo wrote:

> On Tue, 01 Nov 2011 19:37:06 -0200, Tony Nelson <tnelson@starpoint.com> wrote:
> 
>>    void setupRender() {
>>        try {
>>            response.sendRedirect(linkSource.createPageRenderLinkWithContext(ViewUser.class,
userId));
>>        } catch (IOException ioe) {
>>            // shrug?
>>        }
>> 
>>    }
> 
> Why don't you do the redirection the Tapestry way by returning a ViewUser instance on
onActivate() instead of using Response.sendRedirect()?


The code below seems to work, and if it's the accepted way, that's great.  I'll just file
this away in my Tapestry5 toolkit.  Thanks for setting me straight.

Tony

package com.starpoint.instihire.pages.view;

import com.starpoint.instihire.pages.user.ViewUser;
import org.apache.tapestry5.annotations.InjectPage;
import org.apache.tapestry5.annotations.PageActivationContext;

/**
 */
public class User {

    @PageActivationContext
    private com.starpoint.instihire.domain.user.User user;

    @InjectPage
    private ViewUser viewUser;

    ViewUser onActivate() {
        viewUser.setUser(user);
        return viewUser;
    }
}




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


Mime
View raw message