SPRINGMVC the foreground submits multiple objects of different classes or collections of multiple objects of the same class into the background

Source: Internet
Author: User

First, the foreground to pass different classes of different objects

1, the attribute name is different, can be directly encapsulated into the controller method of the object parameters (validated)

2, the property name is duplicated, you can set a value type in the repeating class, and then go back to assigning value type value to the instance variable (validated)

Two, the same class multiple objects collection

Method 1, JSON mode

Method 2, create a new class in which the property is a collection of repeating object classes

Method 3, multiple objects in the foreground JSP input control, the name value is what is, directly in the form form submission or AJAX submission. In the background controller method parameter, do not take these name corresponding parameters, directly use Request.getparametervalues (""), fetch, get to the string array, traverse and encapsulate into the object.

Welcome to add my QQ technology Group 425783133

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.