You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Chanticleer <gu...@gmail.com> on 2010/07/01 16:56:48 UTC

Re: Redirect page

I have no idea why it should be so hard to do redirects. Its such an integral
part of web apps. this Howard guy must be beaten



Benny Law wrote:
> 
> I wish it were built into Tapestry 5 too. It was in previous versions. I
> don't fully understand why Howard took it out, and I don't know of any
> built-in mechanism to abort the current page and redirect to another. I
> guess this is why somebody created the wiki entry. I followed it (with
> some
> modifications) and it works for me.
> 
> Benny
> 
> On Thu, Sep 10, 2009 at 12:54 AM, Xuan Tran Le
> <le...@gmail.com>wrote:
> 
>> Thanks you so much. Maybe I have to follow this link:
>> http://wiki.apache.org/tapestry/Tapestry5RedirectException
>>
>> Is there any built-in for this? I think that my problem is rather common.
>> Why don't you make it be a tapestry built-in?
>>
>> On Thu, Sep 10, 2009 at 11:30 AM, Benny Law <be...@gmail.com>
>> wrote:
>>
>> > I would try something like this:
>> > in B class...
>> >
>> > @PageAttached
>> > private void redirectToC() {
>> >     // ...
>> >     throw new RedirectException("..."); // URL for C
>> > }
>> >
>> > You will need to create RedirectException. I believe there is something
>> in
>> > the wiki on how to handle this exception in AppModule.
>> >
>> > Hope this helps.
>> >
>> > Benny
>> >
>> > On Thu, Sep 10, 2009 at 12:18 AM, Xuan Tran Le <lexuanttkhtn@gmail.com
>> > >wrote:
>> >
>> > > I'm developing a project in portlet mode and I have a problem with
>> page
>> > > redirect:
>> > > - I have 3 pages named A, B, C.
>> > > - In page named A, I have a page link to page B, then I want B auto
>> > > redirect
>> > > to page C
>> > >
>> > > The problem is that in B class I don't know how to redirect to C. I
>> try
>> > to
>> > > call
>> > >
>> > > ---------- B class -------------
>> > > @InjectPage
>> > > private C c;//page C
>> > >
>> > > Object onActivate() {
>> > >   return c;
>> > > }
>> > >
>> > > ------------------------------------
>> > >
>> > > i don't know in B class which phase (which method) can redirect to
>> other
>> > > page.
>> > >
>> > > I did try add a action link to B, then when A call B, in B I click to
>> the
>> > > action link, then I have C. But I don't want to click page B again. I
>> > want
>> > > to click page A then it call to B and in B it auto redirect to C.
>> > >
>> >
>>
> 
> 

-- 
View this message in context: http://old.nabble.com/Redirect-page-tp25377030p29046690.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: Redirect page

Posted by ebt <no...@gmail.com>.
I just spent a bit of time looking for how to redirect, I got halfway through
http://wiki.apache.org/tapestry/Tapestry5RedirectException but LinkFactory
is not a part of 5.2. This threads placement was fortuitously placed. Thanks
Thiago. 



Thiago H. de Paula Figueiredo wrote:
> 
> On Thu, 01 Jul 2010 15:09:04 -0300, Chanticleer <gu...@gmail.com>
> wrote:
> 
>> but honestly, how hard can it be for someone to include a simple  
>> redirect() in their framework?
> 
> Tapestry already provides a very elegant and flexible way of doing  
> redirects, so I think there's no need for a redirect() method.
> 
>> anyway, the "'fundamentals" of Tapestry keep being reset with every  
>> release so its kind of pointless to master all of it.
> 
> The fundamentals are still the same, the implementation has changed. But  
> they won't change again. The whole T5 team is committed to that.
> Howard himself said that using exceptions for redirections in T4 and below  
> was a very bad idea. And I agree.
> 
>> so guys, help a brother out with some redirect code.
> 
> Check your inbox. ;)
> 
> -- 
> 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-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Redirect-page-tp25377030p29051609.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: Redirect page

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Thu, 01 Jul 2010 15:09:04 -0300, Chanticleer <gu...@gmail.com> wrote:

> but honestly, how hard can it be for someone to include a simple  
> redirect() in their framework?

Tapestry already provides a very elegant and flexible way of doing  
redirects, so I think there's no need for a redirect() method.

> anyway, the "'fundamentals" of Tapestry keep being reset with every  
> release so its kind of pointless to master all of it.

The fundamentals are still the same, the implementation has changed. But  
they won't change again. The whole T5 team is committed to that.
Howard himself said that using exceptions for redirections in T4 and below  
was a very bad idea. And I agree.

> so guys, help a brother out with some redirect code.

Check your inbox. ;)

-- 
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-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Redirect page

Posted by Chanticleer <gu...@gmail.com>.
but honestly, how hard can it be for someone to include a simple redirect()
in their framework? anyway, the "'fundamentals" of Tapestry keep being reset
with every release so its kind of pointless to master all of it. so guys,
help a brother out with some redirect code. 



Adam Saltiel-2 wrote:
> 
> If you can't do this for yourself you will never understand T5. It means
> you don't have the fundamentals, you must read up. It isn't hard. Thiego
> gave all the clues
> Adam 
> Sent using BlackBerry® from Orange
> 
> -----Original Message-----
> From: Chanticleer <gu...@gmail.com>
> Date: Thu, 1 Jul 2010 10:44:57 
> To: <us...@tapestry.apache.org>
> Reply-To: "Tapestry users" <us...@tapestry.apache.org>
> Subject: Re: Redirect page
> 
> 
> i meant a metaphorical beating :) but do you think you can share me the
> code
> to do that redirect? i cant for the life of me figure it out. thanks
> 
> 
> Thiago H. de Paula Figueiredo wrote:
>> 
>> On Thu, 01 Jul 2010 11:56:48 -0300, Chanticleer <gu...@gmail.com>
>> wrote:
>> 
>>> I have no idea why it should be so hard to do redirects. Its such an  
>>> integral part of web apps.
>> 
>> What's hard about creating one onActivate() method that returns a page  
>> instance, a page class instance or a java.util.URL?
>> 
>>> this Howard guy must be beaten
>> 
>> Violence is not solution: it just creates more problems. ;)
>> 
>> -- 
>> 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-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://old.nabble.com/Redirect-page-tp25377030p29048613.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Redirect-page-tp25377030p29048828.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: Redirect page

Posted by Adam Saltiel <ad...@gmail.com>.
If you can't do this for yourself you will never understand T5. It means you don't have the fundamentals, you must read up. It isn't hard. Thiego gave all the clues
Adam 
Sent using BlackBerry® from Orange

-----Original Message-----
From: Chanticleer <gu...@gmail.com>
Date: Thu, 1 Jul 2010 10:44:57 
To: <us...@tapestry.apache.org>
Reply-To: "Tapestry users" <us...@tapestry.apache.org>
Subject: Re: Redirect page


i meant a metaphorical beating :) but do you think you can share me the code
to do that redirect? i cant for the life of me figure it out. thanks


Thiago H. de Paula Figueiredo wrote:
> 
> On Thu, 01 Jul 2010 11:56:48 -0300, Chanticleer <gu...@gmail.com>
> wrote:
> 
>> I have no idea why it should be so hard to do redirects. Its such an  
>> integral part of web apps.
> 
> What's hard about creating one onActivate() method that returns a page  
> instance, a page class instance or a java.util.URL?
> 
>> this Howard guy must be beaten
> 
> Violence is not solution: it just creates more problems. ;)
> 
> -- 
> 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-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Redirect-page-tp25377030p29048613.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: Redirect page

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Thu, 01 Jul 2010 14:44:57 -0300, Chanticleer <gu...@gmail.com> wrote:

> i meant a metaphorical beating :)

:)

> but do you think you can share me the code to do that redirect? i cant  
> for the life of me figure it out. thanks

The documentation is here:  
http://tapestry.apache.org/tapestry5.1/guide/pagenav.html.

A little example: suppose you want to redirect from page A to page B  
depending on some logic:

public class A {

	Object onActivate() {

		boolean redirect = ...; // any logic here

		if (redirect) {
			return B.class;
		}
		else {
			return null; // continue normal page processing
		}

	}

}

It can't get much easier and elegant than that. :)

-- 
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-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Redirect page

Posted by Chanticleer <gu...@gmail.com>.
i meant a metaphorical beating :) but do you think you can share me the code
to do that redirect? i cant for the life of me figure it out. thanks


Thiago H. de Paula Figueiredo wrote:
> 
> On Thu, 01 Jul 2010 11:56:48 -0300, Chanticleer <gu...@gmail.com>
> wrote:
> 
>> I have no idea why it should be so hard to do redirects. Its such an  
>> integral part of web apps.
> 
> What's hard about creating one onActivate() method that returns a page  
> instance, a page class instance or a java.util.URL?
> 
>> this Howard guy must be beaten
> 
> Violence is not solution: it just creates more problems. ;)
> 
> -- 
> 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-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Redirect-page-tp25377030p29048613.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: Redirect page

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Thu, 01 Jul 2010 11:56:48 -0300, Chanticleer <gu...@gmail.com> wrote:

> I have no idea why it should be so hard to do redirects. Its such an  
> integral part of web apps.

What's hard about creating one onActivate() method that returns a page  
instance, a page class instance or a java.util.URL?

> this Howard guy must be beaten

Violence is not solution: it just creates more problems. ;)

-- 
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-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org