Springmvc passing parameters of the same name

Source: Internet
Author: User

Springmvc the same field parameter delivery solution for multiple objects, sometimes it is necessary to pass multiple objects in SPRINGMVC 3

No support for struts2-like rules of point syntax in SPRINGMVC

use a bridge connection to encapsulate different sections specifically into one object (recommended)

Advantages: reduced conflict and reduced workload

Cons: Conflicting fields/total fields approaching 1 o'clock is not necessary (however, this is rarely the case, unless it is an inheritance relationship, but the inheritance can use the subclass to pass the value, so this problem you have not encountered)

<form method= ' post ' action= ' URL ' >User name<input type= ' text ' name= ' u_name ' >User ID<input type= ' text ' name= ' u_id ' >Food Name<input type= ' text ' name= ' f_name ' >Food ID<input type= ' text ' name= ' f_id ' > <input type= ' text ' name= ' gender ' > <input type= ' text ' name= ' age ' > < Input type= ' text ' name= ' price ' > <input type= ' text ' name= ' date ' ></form>-----Create a JavaBean field specifically for conflicting fields PublicString ufbridge{PrivateString uname; PrivateString uid; PrivateString fname; PrivateString FID;}--------------------------@requestMap (Value={'/order/book '}) Publicstring Show (User u,food F,ufbridge ufb) {u.setname (Ufb.getuname ());      F.setname (Ufb.getuname ());   U.setid (UFB.GETUID); F.setid (Ufb.getfid);}

Reprinted from: https://my.oschina.net/ososchina/blog/344174

Springmvc passing parameters of the same name

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.