1. Khái quát chung
2. Struts1
The framework just uses one instance of it and only one instance is used to process all incoming requests, care must be taken not to do something with in the Action class that is not thread safe. From the javadoc:
Actions must be programmed in a thread-safe manner, because the controller will share the same instance for multiple simultaneous requests. This means you should design with the following items in mind:
- Instance and static variables MUST NOT be used to store information related to the state of a particular request. They MAY be used to share global resources across requests for the same action.
- Access to other resources (JavaBeans, session variables, etc.) MUST be synchronized if those resources require protection. (Generally, however, resource classes should be designed to provide their own protection where necessary.
This is what the official Apache Struts page says :
Struts 1 Actions are singletons and must be thread-safe since there will only be one instance of a class to handle all requests for that Action. The singleton strategy places restrictions on what can be done with Struts 1 Actions and requires extra care to develop. Action resources must be thread-safe or synchronized.
3. Struts2
4. Tham khảo:
Struts 2 Architecture and FlowIntroduction to the Struts Web Framework
Overview of Struts
Struts document home
Struts Architecture and life-cycle
Struts1 document
Nice Blog, it is very Impressive. Keep Sharing With us.
ReplyDeleteStruts Course in Chennai
Struts Training Institutes in Chennai