Can any one please describe me when the objects of ActionMapper
, ActionProxy
, ActionInvocation
, ActionContext
are created in a Struts2 application. As I am new to Struts2 framework, I am very much confused about the scopes of these objects.
Asked
Active
Viewed 2,073 times
0

Roman C
- 49,761
- 33
- 66
- 176

user2485767
- 1
- 6
1 Answers
0
The ActionMapper
is created on startup, it has a singleton scope.
The ActionContext
is created by the Dispatcher
in preparing an action to execute, it's ThreadLocal, and it doesn't have any scope.
When action is executing the ActionInvocation
and ActionProxy
are created that also don't have a scope.
You can see this on a big picture of Struts2 architecture.

Roman C
- 49,761
- 33
- 66
- 176
-
thanks Roman for this info, but i know ActionContext contains map objects representing SESSION, APPLICATION scoped objects which are accessible in other requests means other thread. so if ActionContext is threadlocalthen how we can access ActionContext contained objects in other threads ? – user2485767 Oct 05 '14 at 12:04
-
By creating and initializing a new ActionContext. – Roman C Oct 05 '14 at 12:30
-
Here if we create another one, then old contents of ActionContext will be destroyed i think.So how can it possible still to access Session contained objects of previous ActionContext here in new request ? – user2485767 Oct 06 '14 at 01:27
-
@user2485767 Because the session is set on the action context. The session is just the servlet spec session. – Dave Newton Oct 06 '14 at 11:01
-
In the other threads it won't destroy, but as Dave mentioned here (thanks Dave) you need to set a session to action context before you use it. The same session objects are in http session, so you can easy access them using servlet API. – Roman C Oct 06 '14 at 11:16