You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by de...@vitalassets.com on 2004/03/25 19:22:24 UTC

How to redirect to another page at render time?

I am stumped trying to figure out how to make Home.page redirect to another page if a certain condition in the visit is not true. In this case if ! visit.isAuthenticated() then redirect to Login. I've tried overriding initialize() and beginReponse() on the Home.java file and it doesn't seem to help at all. I've look at PageEventListener stuff and can't make out how I could use that to redirect on the load of the first page.

Any ideas?

David


--------------------------------------
David Ethell
Senior Engineer, Vital Assets, Inc.
Phone: 800.860.0607 Ex: 102
Email: dethell@vitalassets.com 
3916 Germantown Rd 
Edgewater, MD 21037 
--------------------------------------

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


Re: How to redirect to another page at render time?

Posted by Programozás <pr...@hotmail.com>.
Try validate().
Norbi

----- Original Message ----- 
From: <de...@vitalassets.com>
To: <ta...@jakarta.apache.org>
Sent: Thursday, March 25, 2004 7:22 PM
Subject: How to redirect to another page at render time?


> I am stumped trying to figure out how to make Home.page redirect to
another page if a certain condition in the visit is not true. In this case
if ! visit.isAuthenticated() then redirect to Login. I've tried overriding
initialize() and beginReponse() on the Home.java file and it doesn't seem to
help at all. I've look at PageEventListener stuff and can't make out how I
could use that to redirect on the load of the first page.
>
> Any ideas?
>
> David
>
>
> --------------------------------------
> David Ethell
> Senior Engineer, Vital Assets, Inc.
> Phone: 800.860.0607 Ex: 102
> Email: dethell@vitalassets.com
> 3916 Germantown Rd
> Edgewater, MD 21037
> --------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>

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


Re: How to redirect to another page at render time?

Posted by Programozás <pr...@hotmail.com>.
A little bit longer :)

In the validate() method of the Home page do something like:

public void validate(IRequestCycle cycle)
{
    super.validate(cycle);

    if (!getVisit().isAuthenticated())
    {
        // Here you may set a PageCallback on the Login page,
        // so you can return to the caller page after successful validation
        throw new PageRedirectException("Login");
    }
}

Norbi

----- Original Message ----- 
From: <de...@vitalassets.com>
To: <ta...@jakarta.apache.org>
Sent: Thursday, March 25, 2004 7:22 PM
Subject: How to redirect to another page at render time?


> I am stumped trying to figure out how to make Home.page redirect to
another page if a certain condition in the visit is not true. In this case
if ! visit.isAuthenticated() then redirect to Login. I've tried overriding
initialize() and beginReponse() on the Home.java file and it doesn't seem to
help at all. I've look at PageEventListener stuff and can't make out how I
could use that to redirect on the load of the first page.
>
> Any ideas?
>
> David
>
>
> --------------------------------------
> David Ethell
> Senior Engineer, Vital Assets, Inc.
> Phone: 800.860.0607 Ex: 102
> Email: dethell@vitalassets.com
> 3916 Germantown Rd
> Edgewater, MD 21037
> --------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>

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