Thank you again for your prompt response and time. public class PageA { public Object onActivate() { System.out.println("PageA.onActivate()");
//*********** Start of selected code *********** if (condition) return PageC.class; else return null; //Stay on same page //*********** End of selected code *********** } @OnEvent(value = "doSomeThingAndGotoPageB") public Object gotoPageB() { System.out.println("PageA.onDoSomeThingAndGotoPageB()"); return PageB.class; } } This is the code that we want to use, as you stated in previous emails, if we want to redirect to a different page, we do it in the PageA.onActivate(). (Code in between ******************************) What advice can you give me for this situation where the condition in the PageA.onActivate() for the redirection can give a different result when the user click's on the eventlink ? (The condition is related to a time base issue, so the first time you render the page, the condition is going to take in account the time, but when the user click's on the eventlink, we don't want to consider time as a issue anymore) If we moved the selected code in the @BeginRender, the redirection cannot be done (The return value from a render phase event method was not compatible the expected return type of java.lang.Boolean. You should change the method to return the correct type.) @BeginRender public Object beginRender() { System.out.println("PageA.beginRender()"); //*********** Start of selected code *********** if (condition) return PageC.class; else return null; //Stay on same page //*********** End of selected code *********** } Again, thank you for your time and patience René Date: Thu, 8 Sep 2011 08:11:28 -0700 From: ml-node+4782791-1196683961-92...@n5.nabble.com To: lifestyl...@hotmail.com Subject: Re: Page redirection On Thu, 08 Sep 2011 11:50:31 -0300, LifeStyles ® <[hidden email]> wrote: > Assuming that I cannot avoid calling PageA.onActivate(), is there a way > to distinguish between the PageA.onActivate() called by the eventlink vs > PageA.onActivate called from elsewhere ? > There is some code I would not like to execute in onActivate when it is > called as a result of the eventlink... If you want to do something just when your rendering a page, use a @BeginRender method instead of onActivate(). -- 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: [hidden email] For additional commands, e-mail: [hidden email] If you reply to this email, your message will be added to the discussion below: http://tapestry.1045711.n5.nabble.com/Page-redirection-tp4778938p4782791.html To unsubscribe from Page redirection, click here. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Page-redirection-tp4778938p4783358.html Sent from the Tapestry - User mailing list archive at Nabble.com.