Re: Expiring pages in form submit and onAfterRender...
Did you already look at StatelessForm? Regards, Erik. Op 26-07-10 23:14, Erik Brakkee wrote: Hi, I am experimenting a bit with page expiry. One solution that works is to remove the page from the pagemap in the submit of a form. However, removing the page from the pagemap in the onAfterRender() of a page does not seem to work. In fact, I see the same page id and version being rendered every time. Is this the way it should be? Is there another generic callback in a wicket page in which I could remove the page from the pagemap to expire it? What makes the form's onSubmit() special? Alternatively, I am considering to use a strategy whereby I set an expired flag on form submit and then in the onBeforeRender() use setResponsePage() to delegate to a specific page providing also a specific message. That would allow total control on form submit. Would that strategy work? Cheers Erik -- Sent from my SMTP compliant software Erik van Oosten http://day-to-day-stuff.blogspot.com/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Expiring pages in form submit and onAfterRender...
I have added a configuration in the application to redirect the user to a particular page. I guess page expires due to a timeout? In the base application's init() IApplicationSettings settings = getApplicationSettings(); settings.setPageExpiredErrorPage(LoginPage.class); If that helps in anways. Cheers Niv On Tue, Jul 27, 2010 at 3:18 PM, Erik van Oosten e.vanoos...@grons.nlwrote: Did you already look at StatelessForm? Regards, Erik. Op 26-07-10 23:14, Erik Brakkee wrote: Hi, I am experimenting a bit with page expiry. One solution that works is to remove the page from the pagemap in the submit of a form. However, removing the page from the pagemap in the onAfterRender() of a page does not seem to work. In fact, I see the same page id and version being rendered every time. Is this the way it should be? Is there another generic callback in a wicket page in which I could remove the page from the pagemap to expire it? What makes the form's onSubmit() special? Alternatively, I am considering to use a strategy whereby I set an expired flag on form submit and then in the onBeforeRender() use setResponsePage() to delegate to a specific page providing also a specific message. That would allow total control on form submit. Would that strategy work? Cheers Erik -- Sent from my SMTP compliant software Erik van Oosten http://day-to-day-stuff.blogspot.com/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Expiring pages in form submit and onAfterRender...
Hi Saw a related link to force page expiry probably might throw some light http://apache-wicket.1842946.n4.nabble.com/Force-page-expiration-td1844190.html#a1844190 cheers On Tue, Jul 27, 2010 at 3:23 PM, Nivedan Nadaraj shravann...@gmail.comwrote: I have added a configuration in the application to redirect the user to a particular page. I guess page expires due to a timeout? In the base application's init() IApplicationSettings settings = getApplicationSettings(); settings.setPageExpiredErrorPage(LoginPage.class); If that helps in anways. Cheers Niv On Tue, Jul 27, 2010 at 3:18 PM, Erik van Oosten e.vanoos...@grons.nlwrote: Did you already look at StatelessForm? Regards, Erik. Op 26-07-10 23:14, Erik Brakkee wrote: Hi, I am experimenting a bit with page expiry. One solution that works is to remove the page from the pagemap in the submit of a form. However, removing the page from the pagemap in the onAfterRender() of a page does not seem to work. In fact, I see the same page id and version being rendered every time. Is this the way it should be? Is there another generic callback in a wicket page in which I could remove the page from the pagemap to expire it? What makes the form's onSubmit() special? Alternatively, I am considering to use a strategy whereby I set an expired flag on form submit and then in the onBeforeRender() use setResponsePage() to delegate to a specific page providing also a specific message. That would allow total control on form submit. Would that strategy work? Cheers Erik -- Sent from my SMTP compliant software Erik van Oosten http://day-to-day-stuff.blogspot.com/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Expiring pages in form submit and onAfterRender...
I have indeed seen how to set the default expiry page in the Application class and that might come in handy. Will have a look too at the StatelessForm. Anyway, I have a working solution now with the pagemap trick. However, perhaps I need to do even more, because the flow isList of items - view item page- edit item page- back - back In that case, the first back leads to en Expired page. But, the second back button leads to the view item page showing incorrect contents of the modified item. This is probably because the edit item page has its own copy of the item (even though the edit page was constructed from the view page by passing it the item object). Possibly this happens because of serialization of individual pages. Therefore, the second time the back button is pressed I am viewing stale data. I could solve it perhaps by reloading the entity from the database in the view page's onBeforeRender() and even to check for its existence (item might have been deleted) and in the latter case forward to another page. Or am I going perhaps too far in trying to get consistent views of my application's model?
Re: Expiring pages in form submit and onAfterRender...
Thinking about it some more. Perhaps the best solution is to simply use a detachable model for the entity in the view page and then send the user to an error page when the entry is no longer there. I could of course also use a detachable model for the entity on the edit page because in this page all editing is done on one page and not on multiple pages. This would provide the most userfriendly behavior.
Re: Expiring pages in form submit and onAfterRender...
Made some progress. Now I am removing the page from the page map in the onDetach() and now expiry is really successful. Even so successful that the form submit fails because the page has expired. This is of course logical because the page object is still needed to process the form submit and now I am apparently removing the page too early.