In general, the Struts1 action is a singleton mode, so the developer must ensure that it is thread-safe or synchronous, because there is only one instance of each action in struts 1 that handles all requests.
However, when developing with struts 1, we did not take into account the thread-safety issue, because we used the basic local variables in action, and "Local variables are thread-safe." Because each execution of a method creates a local variable in a separate space, it is not a shared resource. The local variable includes the parameter variable of the method "(forget where it was quoted). In struts 1, all variables are defined in the action in the method we are going to execute (the Execute method in action or the method specified in Dispatchaction), which we use to encapsulate the actionform of the client request parameters, is also passed as a parameter, and it is also a local variable, so there is no thread safety issue.
The action object of Struts 2 produces an instance for each request, so there is no thread-safety issue, although many global variables are defined in the action.
The Struts 2 framework creates a separate thread to handle every user request, and the value stack valuestack is accompanied by a local thread. In the process of the existence of this thread, the value stack can be accessed at will, which guarantees the security of the value stack.
In Struts 2, Actioncontext is a local thread, which means that the actioncontext content in each thread is unique. So developers don't have to worry about the thread safety of the action.
What's the difference between Struts1 and Struts2?