struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lukasz Lenart <lukaszlen...@apache.org>
Subject Re: Struts seems to reset the action instance while its still in interceptor
Date Mon, 04 Nov 2013 12:02:08 GMT
2013/11/4 Ali Akhtar <ali.rac200@gmail.com>:
> Thanks Lukasz, this solved the problem. I really appreciate your help.
> Perhaps it should be mentioned more clearly in the documentation that
> interceptors are meant to be singletons. (If its already mentioned and I
> missed it, I apologize).

http://struts.apache.org/release/2.3.x/docs/writing-interceptors.html

> One more question which I'd appreciate if you could answer. Is anything
> stored via:
>
> ServletActionContext.getContext().put(..)
>
> unique per request as well? E.g, if multiple concurrent requests were being
> made to /foo action, and in the interceptor I was putting a db connection
> object in ServletActionContext.getContext() for each request, can I be sure
> that each db connection put there will only be shared by the instance of
> the Action for that particular request?

ServletActionContext extends ActionContext which is a ThreadLocal
value thus means it's instantiated per request so each action has its
own unique ActionContext.


Regards
-- 
Ɓukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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


Mime
View raw message