conditional redirect page

2009-06-16 Thread tubin gen
I want to use redirect page to redirect , In my case depending on a condition I should redirect to different pages , if condition is true then opage1 if false page 2 can I implement this using redirect page ? If not whats the other alternative ?

Re: conditional redirect page

2009-06-16 Thread Jeremy Thomerson
public class MyPage extends Page { public MyPage() { if (condition1) { throw new RestartResponseAtInterceptPage(Page1.class); } else if (condition2) throw new RestartResponseAtInterceptPage(Page2.class); } throw new RestartResponseAtInterceptPage(Home.class); } -- Jeremy Thomerson

Re: conditional redirect page

2009-06-16 Thread Major Péter
And what's the deal with if (condition1) { setResponsePage(Page1.class); } else { setResponsePage(Page2.class); } return; ?? Is RestartResponseAtInterceptPage better somehow? Thanks Peter 2009-06-16 21:34 keltezéssel, Jeremy Thomerson írta: public class MyPage extends Page { public MyPage()

Re: conditional redirect page

2009-06-16 Thread Igor Vaynberg
just a RestartResponseException will do -igor On Tue, Jun 16, 2009 at 12:34 PM, Jeremy Thomersonjer...@wickettraining.com wrote: public class MyPage extends Page { public MyPage() { if (condition1) { throw new RestartResponseAtInterceptPage(Page1.class); } else if (condition2) throw new

Re: conditional redirect page

2009-06-16 Thread Martin Makundi
just a RestartResponseException will do I've always believed that building flow logic using exceptions is malpractice ** Martin - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands,

Re: conditional redirect page

2009-06-16 Thread Jeremy Thomerson
suggest a better way -- Jeremy Thomerson http://www.wickettraining.com On Tue, Jun 16, 2009 at 2:57 PM, Martin Makundimartin.maku...@koodaripalvelut.com wrote: just a RestartResponseException will do I've always believed that building flow logic using exceptions is malpractice **

Re: conditional redirect page

2009-06-16 Thread Martin Makundi
I use setResponsePage. If there was no other way, I would do RFE ;) ** Martin 2009/6/16 Jeremy Thomerson jer...@wickettraining.com: suggest a better way -- Jeremy Thomerson http://www.wickettraining.com - To

Re: conditional redirect page

2009-06-16 Thread James Carman
The response page is already being rendered. That's why it's being instantiated. On Tue, Jun 16, 2009 at 4:07 PM, Martin Makundi martin.maku...@koodaripalvelut.com wrote: I use setResponsePage. If there was no other way, I would do RFE ;) ** Martin 2009/6/16 Jeremy Thomerson

Re: conditional redirect page

2009-06-16 Thread Igor Vaynberg
when java will have a different way to unroll the stack we will switch. -igor On Tue, Jun 16, 2009 at 12:57 PM, Martin Makundimartin.maku...@koodaripalvelut.com wrote: just a RestartResponseException will do I've always believed that building flow logic using exceptions is malpractice

Re: conditional redirect page

2009-06-16 Thread Major Péter
Still... What if I'm using setResponsPage(Page1.class); return; combo??? Peter 2009-06-16 22:08 keltezéssel, James Carman írta: The response page is already being rendered. That's why it's being instantiated. On Tue, Jun 16, 2009 at 4:07 PM, Martin Makundi

Re: conditional redirect page

2009-06-16 Thread Igor Vaynberg
a) its not as guaranteed as using an exception - you may forget to call return, etc, etc. b) it pollutes the pagemap because the instance of the page that has the navigation logic is stored in the pagemap needlessly - excepton doesnt have this sideffect because the object is destroyed. -igor

Re: conditional redirect page

2009-06-16 Thread Martin Makundi
when java will have a different way to unroll the stack we will switch. Ok so this is an optimization decision that purges something... good to know. Totally new to me. ** Martin -igor On Tue, Jun 16, 2009 at 12:57 PM, Martin Makundimartin.maku...@koodaripalvelut.com wrote: just a

Re: conditional redirect page

2009-06-16 Thread Igor Vaynberg
no, it is not about optimization. we need to unroll the actual call stack to erase state and start executing again from a clean slate. -igor On Tue, Jun 16, 2009 at 1:29 PM, Martin Makundimartin.maku...@koodaripalvelut.com wrote: when java will have a different way to unroll the stack we will