You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Security Management <li...@secmgmt.com> on 2009/02/13 21:58:54 UTC

Interceptor that runs after a view is rendered

I'm using Hibernate, and am going to create an interceptor to run before the
Action to open a session and start a transaction.

After the view is rendered, I want to commit the transaction.

This will result in 1 transaction per request, how can I do the second
(after) interceptor?




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Interceptor that runs after a view is rendered

Posted by Burton Rhodes <bu...@gmail.com>.
If you google: 'hibernate open session in view' you should find plenty
of examples. Especially on hibernate.org



On 2/13/09, Lukasz Lenart <lu...@googlemail.com> wrote:
> 2009/2/13 Security Management <li...@secmgmt.com>:
>> Thanks, the invocation.invoke() will execute all the following
>> interceptors, and render the view, then I can close the transaction and
>> session?
>
> Yes, but remember about correct order of your custom interceptor stack.
>
>
> Regards
> --
> Lukasz
> http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

-- 
Sent from my mobile device

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Interceptor that runs after a view is rendered

Posted by Lukasz Lenart <lu...@googlemail.com>.
2009/2/13 Security Management <li...@secmgmt.com>:
> Thanks, the invocation.invoke() will execute all the following interceptors, and render the view, then I can close the transaction and session?

Yes, but remember about correct order of your custom interceptor stack.


Regards
-- 
Lukasz
http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Interceptor that runs after a view is rendered

Posted by Security Management <li...@secmgmt.com>.
Thanks, the invocation.invoke() will execute all the following interceptors, and render the view, then I can close the transaction and session?

-----Original Message-----
From: Lukasz Lenart [mailto:lukasz.lenart@googlemail.com] 
Sent: Friday, February 13, 2009 4:00 PM
To: Struts Users Mailing List
Subject: Re: Interceptor that runs after a view is rendered

2009/2/13 Security Management <li...@secmgmt.com>:
> I'm using Hibernate, and am going to create an interceptor to run before the
> Action to open a session and start a transaction.
>
> After the view is rendered, I want to commit the transaction.
>
> This will result in 1 transaction per request, how can I do the second
> (after) interceptor?

If you call invocation.invoke() inside your interceptor, the result
will be already rendered then you can do what you want and.


Regards
-- 
Lukasz
http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Interceptor that runs after a view is rendered

Posted by Lukasz Lenart <lu...@googlemail.com>.
2009/2/13 Security Management <li...@secmgmt.com>:
> I'm using Hibernate, and am going to create an interceptor to run before the
> Action to open a session and start a transaction.
>
> After the view is rendered, I want to commit the transaction.
>
> This will result in 1 transaction per request, how can I do the second
> (after) interceptor?

If you call invocation.invoke() inside your interceptor, the result
will be already rendered then you can do what you want and.


Regards
-- 
Lukasz
http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org