Spring By default scope is a single case pattern, that is, scope= "Singleton", which creates only one action object, that is, each access is the same action object and the data is unsafe. And struts2 is required to each access requires a different action, scope= "prototype" can guarantee this requirement, when there is a request to create an Action object.
<span style= "Font-weight:normal;" ><span style= "FONT-SIZE:14PX;" ><!--Configure action-->
<bean id= "testaction" class= "com.lmk.test.TestAction" scope= "prototype" >
<!--action injection <property name= "T" ref= "T"/>-->
</bean></span></span>
The more common point is that if the use of a single example mode, then Struts2 from the foreground data, after processing, once again entered the page, the previous submission of data will be retained.
For example:
Query system users: When the user name a query after the first request, and then enter the query page, the system will retain the previous query conditions.
Of course, you can also set scope= "session" and avoid concurrent problems with action in the web, creating only one bean for the current user until
Session disappears. In this case, the bean is stateful to the current user. The benefit is to create an instance of the bean less and have a
Improvement of the point of performance
Application Scenario:
1. Prototype should be used in most cases
2. If the user is not many, and frequent operation (frequently use action), hardware general, you can consider session, may also improve a little bit of performance.