SPRINGMVC Accurate Data binding

Source: Internet
Author: User

Because using DWZ's lookup function, the value of the callback is xxx.xxvalue from the name, and I have some form data that is not prefixed with the name, and the default binding is problematic for SPRINGMVC background bindings. This is the need to use the Initbinder annotation feature

1     @InitBinder ("Bannerinfo")  2public     void  initBinder1 ( Webdatabinder binder) {  3         binder.setfielddefaultprefix ("Bannerinfo.") );   4     
1 @RequestMapping (value = "/add", method = requestmethod.post)23  public String Add (@ModelAttribute ("Bannerinfo"4     //.....)  5  }
1 <formMethod= "POST"Action= "${contextpath}/banner-info/add"class= "Required-validate pageform"onsubmit= "Return Validatecallback (this, dialogreloadnavtab);">2     <label>Field name</label>3     <inputtype= "text"name= "Bannername" />4     <label>Related number</label>5     <inputtype= "text"name= "Bannerinfo.code" />6     <inputtype= "Submit"value= "Submit" />7 </form>

Reference:

http://jinnianshilongnian.iteye.com/blog/1888474

SPRINGMVC Accurate Data binding

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.