Request acceptance parameters of Struts action

Source: Internet
Author: User

Request acceptance parameters of Struts action
1. Struts2 provides three data encapsulation methods
Action itself acts as a model object and is encapsulated by a member setter
Create an independent model object. The page is encapsulated by ognl expressions.

Use the ModelDriven interface to encapsulate the request data

Action can be a Model or Controler.
2. The Action itself acts as a model object and is encapsulated by a member setter. It is a required property setter method and has no relationship with getter (property-driven method ):


3. Create an independent model object. The page is encapsulated by an ognl expression. The set and get methods (property-driven) of the User must be required) <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> Vc3ryb25np1_vcd4kpha + PHN0cm9uZz48aW1nIHNyYz0 = "http://www.2cto.com/uploadfile/Collfiles/20140817/20140817093455100.png" alt = "\">

4. (1) will there be a thread problem when Action encapsulates data?
Action is multi-instance. Each request creates an Action object without thread security issues.
Servlet. Struts1, which is a singleton. Thread problems exist.
The performance of Struts2 is relatively damaged.

(2). In the first data encapsulation method, data is encapsulated into the Action attribute, and it is impossible
The Action object is passed to the business layer.

(3) who will encapsulate the parameters?
Parameter encapsulation completed by the Interceptor:

. Implement the ModelDriven interface to encapsulate the request data (model-driven)


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.