You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Justin Morgan - Logic Sector <jm...@logicsector.com> on 2008/06/22 09:02:27 UTC
How to tell when a page transition occurs?
Hopefully a simple problem for the group... What's the best way to be
notified when the application transitions from one page to another?
Does the application object receive any Wicket messages like
"onPageTransition()" or anything like that?
I ask because--in my application--when the user finishes interacting
with Page A (typing data, submitting form, typing more data,
submitting form again) and then transitions to Page B, I need to
commit or rollback the database transaction that holds Page A inserts/
updates. This has to happen before the user actually sees Page B
because there could be a problem with Page A data.
BTW, in case it matters, I'm using an object database so I probably
can't take advantage of any Wicket extensions for Hibernate or whatnot.
Thanks for any info!
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: How to tell when a page transition occurs?
Posted by Igor Vaynberg <ig...@gmail.com>.
the ui layer is not the best to control transactions to such a fine grain...
what you can do is create subclasses of Link, BookmarkablePageLink,
Button to do this, that way you wont forget.
as far as error page...what kind of scenario are you thinking? you can
setup your own error pages that perform a rollback when instantiated.
but to me, this all sounds like a bad idea, sounds like you are trying
to control transactions from a wrong place.
-igor
On Sun, Jun 22, 2008 at 11:11 AM, Justin Morgan - Logic Sector
<jm...@logicsector.com> wrote:
> Thanks for your response, but what do I do in case the case of the error
> page, for example? I'm not performing the transition myself in that case
> (but I still need to do a rollback).
>
> Plus, there are a lot of ways to go from page to page. It seems a pain to
> add commit code to every link event handler, every button event handler,
> etc, that takes the user from one page to another (plus there's the
> possibility of forgetting to add it somewhere).
>
> Therefore it would be nice if there was one place where the Wicket framework
> could automatically tell the programmer, "Hey, you're going to transition to
> a new page now", so that the programmer has a chance to do any cleanup etc.
> That's why I was hoping there's a "onPageTransition()" method on the
> application object, or something along those lines.
>
> - J
>
> On Jun 22, 2008, at 8:19 AM, Igor Vaynberg wrote:
>
>> since you are the one performing the transition from A to B you can
>> commit yourself, no?
>>
>> -igor
>>
>> On Sun, Jun 22, 2008 at 12:02 AM, Justin Morgan - Logic Sector
>> <jm...@logicsector.com> wrote:
>>>
>>> Hopefully a simple problem for the group... What's the best way to be
>>> notified when the application transitions from one page to another? Does
>>> the application object receive any Wicket messages like
>>> "onPageTransition()"
>>> or anything like that?
>>>
>>> I ask because--in my application--when the user finishes interacting with
>>> Page A (typing data, submitting form, typing more data, submitting form
>>> again) and then transitions to Page B, I need to commit or rollback the
>>> database transaction that holds Page A inserts/updates. This has to
>>> happen
>>> before the user actually sees Page B because there could be a problem
>>> with
>>> Page A data.
>>>
>>> BTW, in case it matters, I'm using an object database so I probably can't
>>> take advantage of any Wicket extensions for Hibernate or whatnot.
>>>
>>> Thanks for any info!
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: How to tell when a page transition occurs?
Posted by James Carman <ja...@carmanconsulting.com>.
So, have your link/form logic actually call some other object's
method. Then, make that method transactional and use something like
Spring to manage your transaction demarcation.
On Sun, Jun 22, 2008 at 2:11 PM, Justin Morgan - Logic Sector
<jm...@logicsector.com> wrote:
> Thanks for your response, but what do I do in case the case of the error
> page, for example? I'm not performing the transition myself in that case
> (but I still need to do a rollback).
>
> Plus, there are a lot of ways to go from page to page. It seems a pain to
> add commit code to every link event handler, every button event handler,
> etc, that takes the user from one page to another (plus there's the
> possibility of forgetting to add it somewhere).
>
> Therefore it would be nice if there was one place where the Wicket framework
> could automatically tell the programmer, "Hey, you're going to transition to
> a new page now", so that the programmer has a chance to do any cleanup etc.
> That's why I was hoping there's a "onPageTransition()" method on the
> application object, or something along those lines.
>
> - J
>
> On Jun 22, 2008, at 8:19 AM, Igor Vaynberg wrote:
>
>> since you are the one performing the transition from A to B you can
>> commit yourself, no?
>>
>> -igor
>>
>> On Sun, Jun 22, 2008 at 12:02 AM, Justin Morgan - Logic Sector
>> <jm...@logicsector.com> wrote:
>>>
>>> Hopefully a simple problem for the group... What's the best way to be
>>> notified when the application transitions from one page to another? Does
>>> the application object receive any Wicket messages like
>>> "onPageTransition()"
>>> or anything like that?
>>>
>>> I ask because--in my application--when the user finishes interacting with
>>> Page A (typing data, submitting form, typing more data, submitting form
>>> again) and then transitions to Page B, I need to commit or rollback the
>>> database transaction that holds Page A inserts/updates. This has to
>>> happen
>>> before the user actually sees Page B because there could be a problem
>>> with
>>> Page A data.
>>>
>>> BTW, in case it matters, I'm using an object database so I probably can't
>>> take advantage of any Wicket extensions for Hibernate or whatnot.
>>>
>>> Thanks for any info!
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: How to tell when a page transition occurs?
Posted by Justin Morgan - Logic Sector <jm...@logicsector.com>.
Thanks for your response, but what do I do in case the case of the
error page, for example? I'm not performing the transition myself in
that case (but I still need to do a rollback).
Plus, there are a lot of ways to go from page to page. It seems a
pain to add commit code to every link event handler, every button
event handler, etc, that takes the user from one page to another (plus
there's the possibility of forgetting to add it somewhere).
Therefore it would be nice if there was one place where the Wicket
framework could automatically tell the programmer, "Hey, you're going
to transition to a new page now", so that the programmer has a chance
to do any cleanup etc. That's why I was hoping there's a
"onPageTransition()" method on the application object, or something
along those lines.
- J
On Jun 22, 2008, at 8:19 AM, Igor Vaynberg wrote:
> since you are the one performing the transition from A to B you can
> commit yourself, no?
>
> -igor
>
> On Sun, Jun 22, 2008 at 12:02 AM, Justin Morgan - Logic Sector
> <jm...@logicsector.com> wrote:
>> Hopefully a simple problem for the group... What's the best way to
>> be
>> notified when the application transitions from one page to
>> another? Does
>> the application object receive any Wicket messages like
>> "onPageTransition()"
>> or anything like that?
>>
>> I ask because--in my application--when the user finishes
>> interacting with
>> Page A (typing data, submitting form, typing more data, submitting
>> form
>> again) and then transitions to Page B, I need to commit or rollback
>> the
>> database transaction that holds Page A inserts/updates. This has
>> to happen
>> before the user actually sees Page B because there could be a
>> problem with
>> Page A data.
>>
>> BTW, in case it matters, I'm using an object database so I probably
>> can't
>> take advantage of any Wicket extensions for Hibernate or whatnot.
>>
>> Thanks for any info!
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: How to tell when a page transition occurs?
Posted by Igor Vaynberg <ig...@gmail.com>.
since you are the one performing the transition from A to B you can
commit yourself, no?
-igor
On Sun, Jun 22, 2008 at 12:02 AM, Justin Morgan - Logic Sector
<jm...@logicsector.com> wrote:
> Hopefully a simple problem for the group... What's the best way to be
> notified when the application transitions from one page to another? Does
> the application object receive any Wicket messages like "onPageTransition()"
> or anything like that?
>
> I ask because--in my application--when the user finishes interacting with
> Page A (typing data, submitting form, typing more data, submitting form
> again) and then transitions to Page B, I need to commit or rollback the
> database transaction that holds Page A inserts/updates. This has to happen
> before the user actually sees Page B because there could be a problem with
> Page A data.
>
> BTW, in case it matters, I'm using an object database so I probably can't
> take advantage of any Wicket extensions for Hibernate or whatnot.
>
> Thanks for any info!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org