yes this is because the homepage is set as a reponsepage
AND you are redirecting to another page.. in the
Look
this is what happens, this is a piece of code that handles the homepage:
Page newPage = newPage(homePage);
setResponsePage(newPage);
first line the homepage is constructed
second line it is set as the wanted page
Now if you redirect or set the homepage in youre constructor of that page
then that redirect is immediately executed
after that we are setting the response page
and that one is done in the RequestCycle.respond()
and that one is also setting the redirect (second time is forbidden)
Please be carefull not to call redirectTo directly youreself
Everybody should call
setResponsePage()
and if you want really a redirect instead of what the application
settings redirect strategy is telling use
you do:
setRedirect(true)
because if you use redirectTo() in the ComponentListener phase of wicket
(event handling part)
then you are mixing event handling and rendering phases.
Normally you could use setResponsePage just fine in youre constructor.
No problem
Except in the homepage... because there we set the response for you (you
don't do it in youre code)
that is the problem you have here.
In 1.1 head stream i already implemented HomePage redirect strategies..
/**
* Use this homepage strategy if you don't want to redirect so the
url just stays /
*/
public static final HomePageStrategy NO_REDIRECT = new
HomePageStrategy("no-redirect");
/**
* Use this homepage strategy if you want to redirect the homepage
to a bookmarkable url like: page=mybookmarkablepage
* This is the same as calling: setResponsePage(MyPage.class);
*/
public static final HomePageStrategy BOOKMARK_REDIRECT = new
HomePageStrategy("bookmark-redirect");
/**
* Use this homepage strategy if you want to redirect the homepage
just as a normal page would be in
* wicket (when you submit a form on the page or when you do in the
code: setResponsePage(new MyPage());
* If you have set the overall Redirect Strategy to ONE_PASS_RENDER
then the homepage response will honor that.
* Then it is the same as setting the homepage strategy to NO_REDIRECT.
*/
public static final HomePageStrategy PAGE_REDIRECT = new
HomePageStrategy("page-redirect");
I could add one more:
public static final HomePageStrategy DO_NOTHING = new
HomePageStrategy("do-nothing");
then we don't set the response page. That is completely up to the
developer to do that in its home page class.
What don't get is why not set the page you are going to in the
constructor of the home page as once??
Because you don't have outside state (from the browser). So it is not
really dynamic where you could go to..
Or do you know it because you read some database values where you have
described what page is now the home page??
johan
josh lim wrote:
Hi
It _does_ work with redirectToInterceptPage and redirectTo, but I get
this error below...
wicket.WicketRuntimeException: Already redirecting to
'/idea/survey?component=4&version=0&interface=IRedirectListener'.
Cannot redirect more than once
....
Josh
On 7/16/05, Matej Knopp <[EMAIL PROTECTED]> wrote:
It doesn't seem to be inconsistent to me.
SetResponsePage sets a page to respond. But IMHO to respond you need an
action first. In constructor, there's no such action. When you click on
a link or submit a form, it is an action. So SetResponsePage works.
But this is just as I see it. It's possible that it's meant otherwise
and it's just a bug.
Maybe it would be better if SetResponsePage worked this well. But I
think that it's worth implementing only if it's not a big change/hack to
wicket action/request/response handling.
-Matej
Eelco Hillenius wrote:
Yes, but I think it is inconsistent. Don't you think so?
Eelco
Matej Knopp wrote:
This does work, but you have to call redirectTo instead of
setResponsePage in your constructor.
like
redirectTo (new Page1(parameters));
-Matej
josh lim wrote:
I tried to use a setRespnosePage at first since that was how I used it
on the "onSubmit" callbacks... but it did not redirect when I put it
in the constructor of this Start page.
I used to play with struts a little and it had a "forward" tag which
allowed a forwarding of requests together with all the
parameters...which is essentially what I want to do.
I would have thougth setResponsePage(new Page1(parameters)) could have
done the same thing.
Josh
On 7/16/05, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
I mean, setResponsePage.
Eelco Hillenius wrote:
Actually, now that I look at it, it isn't even clear what
redirectToInterceptPage should do what can't be done with
setResponsePage. Idea's anyone? If we cannot find a good case - I
might have missed something - I think we should remove this method
from the API.
Josh, have you tried using setResponse instead of
redirectToInterceptPage?
Eelco
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user