tapestry-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Eynon <steve.ey...@alienfactory.co.uk>
Subject Re: 5.3-rc-2 Exception
Date Wed, 02 Nov 2011 14:28:48 GMT
Yeah, that's exactly what Thiago meant and is a good way to redirect
to a page with a given context.

Or if you don't like having setters in your page ('cos it's a bit
intrusive) a compromise would be:

Link onActivate() {
    linkSource.createPageRenderLinkWithContext(ViewUser.class, userId)
}

The full list of component return values is given here:

http://tapestry.apache.org/page-navigation.html#PageNavigation-ComponentEventRequests

Steve.


On 2 November 2011 21:50, Tony Nelson <tnelson@starpoint.com> wrote:
>
> 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
>
>

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


Mime
View raw message