Session Undo
I've been trying to find some information on Wicket's session handling. From what I understand, Wicket solves the back button problem (and it does so perfectly), but there are times when certain pages are simply no longer correct. Wicket is supposed to detect this, but I have a hard time figuring out how that would work -- or even how Wicket could possibly do this without some additional help from my side. Anyway, my problem is this: I've got a form with some validation. At some point the user can press a Save button to commit this form to the database. So for example: Overview Page - Edit step 1 - Edit step 2 - Save/Undo When the user reaches Save/Undo, pressing back would go back to stale data (as the database has already been updated). How do I inform wicket that those previous pages are out of date? I've been looking at session.invalidate() and session.clear(), but the documentation seems to indicate that these methods are only rarely used (which seems to contradict what I want, as I would likely need these methods after every commit to the database). On a similar note, Wicket keeps track of previous states as it needs those for providing a correctly functioning Back button. Now, I'm wondering if this can be used to provide the user with the ability to Undo things that were entered in a form (currently I just requery the data when the user pressed Undo). In my example, going back to the Overview Page step (when Undo is pressed) would achieve the same goal... I'm not using any frameworks that might help with transaction boundaries or anything, basically it is just an embedded tomcat, wicket and hibernate. I'm (still) new to wicket, any hints in the right direction are appreciated. --John - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Session Undo
it really depends on what you want to happen. the easiest thing is to evict the page from the pagemap when the user is done with it - that way when the user attempts to submit the form they will get a page-expired error. to remove the page simply getpagemap().removepage(this); with a bit more work you can show a custom error: class singlesubmitform extends form { private boolean submitted=false; protected void onsubmit() { if (submitted) {showerror(); return;} whatever(); submitted=true; } } -igor On Tue, May 12, 2009 at 8:08 AM, John Hendrikx hj...@xs4all.nl wrote: I've been trying to find some information on Wicket's session handling. From what I understand, Wicket solves the back button problem (and it does so perfectly), but there are times when certain pages are simply no longer correct. Wicket is supposed to detect this, but I have a hard time figuring out how that would work -- or even how Wicket could possibly do this without some additional help from my side. Anyway, my problem is this: I've got a form with some validation. At some point the user can press a Save button to commit this form to the database. So for example: Overview Page - Edit step 1 - Edit step 2 - Save/Undo When the user reaches Save/Undo, pressing back would go back to stale data (as the database has already been updated). How do I inform wicket that those previous pages are out of date? I've been looking at session.invalidate() and session.clear(), but the documentation seems to indicate that these methods are only rarely used (which seems to contradict what I want, as I would likely need these methods after every commit to the database). On a similar note, Wicket keeps track of previous states as it needs those for providing a correctly functioning Back button. Now, I'm wondering if this can be used to provide the user with the ability to Undo things that were entered in a form (currently I just requery the data when the user pressed Undo). In my example, going back to the Overview Page step (when Undo is pressed) would achieve the same goal... I'm not using any frameworks that might help with transaction boundaries or anything, basically it is just an embedded tomcat, wicket and hibernate. I'm (still) new to wicket, any hints in the right direction are appreciated. --John - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Session Undo
hi, was just wondering if this is possible if i'm using the current page as a reference to the previous page for the next screen. if i do this will i have errors? thanks On Wed, May 13, 2009 at 12:46 AM, Igor Vaynberg igor.vaynb...@gmail.com wrote: it really depends on what you want to happen. the easiest thing is to evict the page from the pagemap when the user is done with it - that way when the user attempts to submit the form they will get a page-expired error. to remove the page simply getpagemap().removepage(this); with a bit more work you can show a custom error: class singlesubmitform extends form { private boolean submitted=false; protected void onsubmit() { if (submitted) {showerror(); return;} whatever(); submitted=true; } } -igor On Tue, May 12, 2009 at 8:08 AM, John Hendrikx hj...@xs4all.nl wrote: I've been trying to find some information on Wicket's session handling. From what I understand, Wicket solves the back button problem (and it does so perfectly), but there are times when certain pages are simply no longer correct. Wicket is supposed to detect this, but I have a hard time figuring out how that would work -- or even how Wicket could possibly do this without some additional help from my side. Anyway, my problem is this: I've got a form with some validation. At some point the user can press a Save button to commit this form to the database. So for example: Overview Page - Edit step 1 - Edit step 2 - Save/Undo When the user reaches Save/Undo, pressing back would go back to stale data (as the database has already been updated). How do I inform wicket that those previous pages are out of date? I've been looking at session.invalidate() and session.clear(), but the documentation seems to indicate that these methods are only rarely used (which seems to contradict what I want, as I would likely need these methods after every commit to the database). On a similar note, Wicket keeps track of previous states as it needs those for providing a correctly functioning Back button. Now, I'm wondering if this can be used to provide the user with the ability to Undo things that were entered in a form (currently I just requery the data when the user pressed Undo). In my example, going back to the Overview Page step (when Undo is pressed) would achieve the same goal... I'm not using any frameworks that might help with transaction boundaries or anything, basically it is just an embedded tomcat, wicket and hibernate. I'm (still) new to wicket, any hints in the right direction are appreciated. --John - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org