You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Markus Demetz <ma...@demetz.eu> on 2012/02/15 21:52:10 UTC
Call a function after invocation but before jsp rendering
hi there,
my application uses struts2 (latest version), siles with JSP and hibernate.
what I am trying to do is to call a method after the action has been
executed, but before the JSP is getting rendered.
to be concrete, I want to call a createTitle() method which is common
for all my actions (extending BaseAction with a default implementation
of createTitle()), but when I use an Interceptor for that and call it
after the action invocation, the JSP has already been rendered. So my
question is, at which point is the JSP rendered? can I do something between?
since I want to be able to set the title according to eventual errors, I
cannot do that before the action invocation.
any suggestions?
thanks, markus
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Call a function after invocation but before jsp rendering
Posted by Jeffrey Black <je...@gmail.com>.
FWIW, the AnnotationWorklowInterceptor along with the @BeforeResult may be utilized.
struts.apache.org/2.x/docs/annotationworkflowinterceptor.html
On Feb 15, 2012, at 2:58 PM, Markus Demetz <ma...@demetz.eu> wrote:
> perfect, didn't know that interceptor..!
> thank you!!
>
> Am 15.02.2012 21:54, schrieb Dave Newton:
>> On Wed, Feb 15, 2012 at 3:52 PM, Markus Demetz wrote:
>>
>>> to be concrete, I want to call a createTitle() method which is common for
>>> all my actions (extending BaseAction with a default implementation of
>>> createTitle()), but when I use an Interceptor for that and call it after
>>> the action invocation, the JSP has already been rendered. So my question
>>> is, at which point is the JSP rendered? can I do something between?
>>>
>> Yes, your interceptor can use a PreResultListener to wedge itself
>> in-between the invocation and render.
>>
>> Dave
>>
>
>
> ---------------------------------------------------------------------
> 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: Call a function after invocation but before jsp rendering
Posted by Markus Demetz <ma...@demetz.eu>.
perfect, didn't know that interceptor..!
thank you!!
Am 15.02.2012 21:54, schrieb Dave Newton:
> On Wed, Feb 15, 2012 at 3:52 PM, Markus Demetz wrote:
>
>> to be concrete, I want to call a createTitle() method which is common for
>> all my actions (extending BaseAction with a default implementation of
>> createTitle()), but when I use an Interceptor for that and call it after
>> the action invocation, the JSP has already been rendered. So my question
>> is, at which point is the JSP rendered? can I do something between?
>>
> Yes, your interceptor can use a PreResultListener to wedge itself
> in-between the invocation and render.
>
> Dave
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Call a function after invocation but before jsp rendering
Posted by Dave Newton <da...@gmail.com>.
On Wed, Feb 15, 2012 at 3:52 PM, Markus Demetz wrote:
> to be concrete, I want to call a createTitle() method which is common for
> all my actions (extending BaseAction with a default implementation of
> createTitle()), but when I use an Interceptor for that and call it after
> the action invocation, the JSP has already been rendered. So my question
> is, at which point is the JSP rendered? can I do something between?
>
Yes, your interceptor can use a PreResultListener to wedge itself
in-between the invocation and render.
Dave