I was searching to know the number of instances created per Action class in Struts 1.x, then I found that it is a Singleton. But I have a doubt: In the action mapping section of struts-config.xml
we define the action tag, where there is a scope variable. In that scope variable we can put the value as request, session etc. I wonder that if Action class is a Singleton, then what does this scope variable signify? Does the number of instances per Action class depend upon the scope variable, i.e. if scope is set to "session" the number of instance created depend upon the number of user connected?
Asked
Active
Viewed 1,207 times
2
1 Answers
2
The "scope"
attribute specifies the scope of the ActionForm
only. This allows wizard-like session-based forms to span action mappings, or request-based forms that last only a single request.
There is a single Action
instance per mapping (in contrast to an instance per-request, as some frameworks do). Action
s should be treated like servlets, and written with thread-safety in mind.

Dave Newton
- 158,873
- 26
- 254
- 302