No Wicket redirects to the same instance on a submit. All interface methods will allways go back to the same page instance. Only when you call a bookmarkeable page or e.g. create one yourself, a new instance will be created. And on a cluster, your page will be replicated so it has the same state.

Eelco


Gili wrote:


But if I set the visible property to true only once a user clicks submit, isn't it too late? I mean, my Page constructor is the one adding all the components into itself. When the user hits Submit, doesn't Wicket redirect him back to the same Page but with a new instance? I'm very confused on the lifetime of Page objects. If I can't depend on the Page object being reused (because of clusters, etc) and I have to assume a new Page instance will be created once the user hits Submit then when I change visible to true, won't it get lost because the new Page will create brand new instances of the components...?


Gili

Eelco Hillenius wrote:

You can do that easier I think. Just have your redirect header in there all the time, but have the visible property false. In your submit handler, you set the visible property true, and the redirect will happen. If you want to be sure the flag is only set false when you are in your submit routine, one of the things you could do is override the page's onBeginRequest and set the visible flag to false each time.

If you want to do it your way (isRedirectRequested), set that property in your submit handler, and it will stay the same as long as that instance lives. A new instance will start fresh offcourse.

Eelco

Eelco

Gili wrote:


When a user enters a valid email address I want the form to refresh, output "<address> has been subscribed" in the feedback panel and five seconds later redirect the client to another Page.


The question though is how does one retain state across Page refreshes? I mean, when the user first enters the email and clicks SUBMIT, I want to set a flag isRedirectRequested to true such that the next time that same page renders, it knows output an extra line of HTML to redirect the client after five seconds. How does one retain Page state like I mentioned?

Thanks,
Gili


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user






-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to