struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Grobmeier <>
Subject Re: Struts 2 Interceptor Question
Date Fri, 22 Apr 2011 14:55:36 GMT
> Can a Struts 2 interceptor change/add a request or session parameter?

Yes, and you can look at an example when you have the source and open:

> I'm trying to write a Struts 2 Exception Handler which is executed whenever
> there is an uncaught exception. To do that, I plan to use a custom
> interceptor based on the existing Struts 2 ExceptionMappingInterceptor. My
> custom interceptor needs to be able to send customized text to a jsp page
> which is displayed to the user. For example, a unique incidentId number will
> be displayed on the jsp page.
> Inside my intercept method, I can access the AccessInvocation's
> InvocationContext which contains the following methods:
> Map - getParameters()
> Map - getSession()
> void - put(key, value)
> Object - get(key)
> I tried modifying the Map returned by getParameters() and getSession(). I
> also tried using put(key, value). However, my changes were not visible on
> the jsp page when I used these methods.
> Is it possible to modify a request or session variable from an interceptor?
> Is there a better way to load dynamic information into a struts
> global-exception-mapping error page?

As far as I can see it is done inside setParameters and its done via
the ActionContext method. But I am not sure why your changes are not
reflected. Anyway, hope this class gives you some inspiration.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message