因为使用dwz 的lookup功能,回调的值通过name以 xxx.xxValue 来自动得到,而我还有些表单数据的name是没有前缀的, 到springmvc后台绑定的的话默认的绑定是有问题的。这是需要用到 initBinder 注解功能

     @InitBinder("bannerInfo")
public void initBinder1(WebDataBinder binder) {
binder.setFieldDefaultPrefix("bannerInfo.");
}
 @RequestMapping(value = "/add", method = RequestMethod.POST)
@ResponseBody
public String add(@ModelAttribute("bannerInfo") BannerInfo bannerInfo) {
//。。。。。
}
 <form method="POST" action="${contextPath}/banner-info/add" class="required-validate pageForm" onsubmit="return validateCallback(this, dialogReloadNavTab);">
<label>栏位名称</label>
<input type="text" name="bannerName" />
<label>相关编号</label>
<input type="text" name="bannerInfo.code" />
<input type="submit" value="提交" />
</form>

参考:

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

springmvc 数据精准绑定的更多相关文章

  1. 扩展SpringMVC以支持绑定JSON格式的请求参数

    此方案是把请求参数(JSON字符串)绑定到java对象,,@RequestBody是绑定内容体到java对象的. 问题描述: <span style="font-size: x-sma ...

  2. SpringMVC数据验证

    SpringMVC数据验证——第七章 注解式控制器的数据验证.类型转换及格式化——跟着开涛学SpringMVC 资源来自:http://jinnianshilongnian.iteye.com/blo ...

  3. springmvc(2)--参数绑定

    一.以实例来看springmvc各种参数绑定方式   先定义个dto类: public class RestInDto implements Serializable { private static ...

  4. SpringMVC的参数绑定

    一.@RequestMapping注解说明   通过@RequestMapping注解可以定义不同的处理器映射规则. URL路径映射 @RequestMapping(value="/item ...

  5. springMVC-接收数据-参数绑定

    接收数据-参数绑定 #Method Arguments概观 Same in Spring WebFlux The table below shows supported controller meth ...

  6. (转)SpringMVC学习(六)——SpringMVC高级参数绑定与@RequestMapping注解

    http://blog.csdn.net/yerenyuan_pku/article/details/72511749 高级参数绑定 现在进入SpringMVC高级参数绑定的学习,本文所有案例代码的编 ...

  7. SpringMVC在对应绑定不同实体,但具有相同属性名的解决方案....

    在springmvc中,可以对前台传递过来的参数进行与后台实体绑定(第二种方式相对较好). 比如: 前台页面: <form action="${pageContext.request. ...

  8. (八)springMvc 的参数绑定

    参数绑定 将客户端传来的 key/value 数据,绑定到 Controller 参数的过程 : 这一过程发生在调用 处理器适配器 的时候,spring 会去调用 参数绑定 组件,我使用的版本(4.5 ...

  9. SpringMVC数据校验并通过国际化显示错误信息

    目录 SpringMVC数据校验并通过国际化显示错误信息 SpringMVC数据校验 在页面中显示错误信息 通过国际化显示错误信息 SpringMVC数据校验并通过国际化显示错误信息 SpringMV ...

随机推荐

  1. CF 84D Doctor(二分)

    题目链接: 传送门 Doctor time limit per test:1 second     memory limit per test:256 megabytes Description Th ...

  2. iOS - 全屏滑动

    取经地址 1.使用关联 关联是指把两个对象相互关联起来,使得其中的一个对象作为另一个对象的一部分. 使用关联,是基于关键字的,因此,我们可以为任意对象增加任意多的关联,但是关键字是唯一的.关联可以保证 ...

  3. 数论 Note.

    1. $ax+by=1 \rightarrow gcd(a,b)=1$ 2.如果一个数的后n位能被$2^n$整除,那么这个数能被$2^n$整除. 3.如果一个数的各位数之和能被3,9整除,那么这个数能 ...

  4. python运维开发坎坷之路-01

    前言 2014年9月,新疆乌鲁木齐,在51CTO学院看着alex老师的python教学视频,不得不说这是我第一次接触python这门高级语言,从最开始的一无所知到现在能够用python写脚本,再到未来 ...

  5. Django 部署 uwsgi + nginx + supervisor

    Django 部署 uwsgi + nginx + supervisor https://hacpai.com/article/1460607620615?p=1&m=0 zonghua • ...

  6. Linux环境下发布项目(Tomcat重新启动)

    在Linux系统下,重启Tomcat 首先,进入Tomcat下的bin目录 cd /usr/local/tomcat/bin 使用Tomcat关闭命令 ./shutdown.sh 查看Tomcat是否 ...

  7. DS18B20函数库建立实验

    1.主代码: /* 温度传感器  */#include "DS18B20.h"#include"def.h"u16 get_temp (void){    fl ...

  8. SQL Server 2012 学习笔记1

    1. 新建的数据库会产生两个文件(数据文件.mdf 和日志文件.ldf) 2. 编辑表格和为表格录入数据 "Design"为设计表格,"Edit Top 200 Rows ...

  9. Datatable的Select()

    利用datatable的select方法筛选出符合条件的datarow进行操作 Select() Select(string filterExpression) Select(string filte ...

  10. Java代码块

    代码块分为普通代码块.构造块.静态代码块.同步代码块4种 普通代码块 普通代码块是指直接在方法或者是语句中定义的代码块 构造块 构造块是直接写在类中的代码块 构造块优先于构造方法执行,而且每次实例化对 ...