besides the similarity

i guess ur beginRender should return false for redirect

refering to the state diagram

http://tapestry.apache.org/tapestry5/tapestry-core/guide/rendering.html


Travis McLeskey wrote:
Ah, thanks, that works for me. Here's what I did:

    @Inject
    private Response response;

    @Inject
    private LinkFactory linkFactory;

    public Object beginRender() throws IOException {
        if( isLoginNeeded() )
response.sendRedirect( linkFactory.createPageLink("Login", true) );
        return true;
    }

I wish there were a cleaner way, but that'll do.

Thanks,
Travis



On Feb 10, 2008, at 9:06 PM, Dapeng wrote:

what i am doing is

@Inject
private Response response;

boolean beginRender(){

  if( isRedirectNeeded() ) {
           try { response.sendRedirect("") } catch (Exception e) {}
           return false;
  }

}



Travis McLeskey wrote:
In a page, you can listen for the "activate" event and, for example, if the user doesn't have permission to view that page, you can return a value (Page, Class, String, etc.) that triggers a redirect to another page.

Is it possible to do the same when a component is loading/rendering? Components don't receive the "activate" event, and I haven't had any luck returning a page object from setupRender() and beginRender().

Thanks,
Travis


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to