SpringMvc參数的接受以及serializeArray的使用方法
需求:从页面提交一个table中的数据到后台,通经常使用于批量改动
把全部的数据到放到 input属性中,设置name定义成为对象的相关属性,使用Jquery的serializeArray这种方法封装成为对象,详细实现參考代码
$.post("radixAdjustAll.do", $("#fm").serializeArray(),function(flag){
if(flag="true"){
var url=window.location.href;
window.location.href=url;
}else{
var ctn = "<div class='title'>保存失败!
</div>";
ResultUtils.showError({
dialog:dlg,
content:ctn
});
}
});
</pre><pre name="code" class="javascript">
</pre><pre name="code" class="java"> <#assign index = 0 />
<#if products.list?size gt 0>
<#list products.list as partner>
<tr class="${partner[0].no}${index}">
<td align="center">${partner[0].applyerCode}</td>
<td>${partner[0].applyerName}</td>
<td align="center">${partner[0].bigAreaName}</td>
<td align="center">${partner[0].areaName}</td>
<td id="td" value="aa" width="50px">
<input readOnly="true" type="text" name="partnerProducts[${index}].stockMin" class="min u-text2 required" value="${partner[1].stockMin}" style="width:40px;text-align: right;"/></td>
<td><input readOnly="true" type="text" name="partnerProducts[${index}].stockMax" class="max u-text2 required" value="${partner[1].stockMax}" style="width:40px;text-align: right;"/></td>
<td><input type="text" name="partnerProducts[${index}].radixMin" class="radixMin u-text2 required" value="${partner[1].radixMin}" style="width:40px;text-align: right;"/></td>
<td><input type="text" name="partnerProducts[${index}].radixMax" class="radixMax u-text2 required" value="${partner[1].radixMax}" style="width:40px;text-align: right;"/></td>
<td><input type="text" name="partnerProducts[${index}].stockAvg" class="stockAvg u-text2 required" value="${partner[1].stockAvg}" style="width:40px;text-align: right;"/></td>
<td><input type="text" name="partnerProducts[${index}].divideQuantity" class="divideQuantity u-text2 required" value="${partner[1].divideQuantity}" style="width:40px;text-align: right;"/></td>
<td><input type="text" name="partnerProducts[${index}].startDt" value="${(partner[1].startDt? string('yyyy-MM-dd'))!}" class="ui-datepicker-input u-text2 startDt"/></td>
<td><input type="text" name="partnerProducts[${index}].invalidDt" value="${(partner[1].invalidDt? string('yyyy-MM-dd'))!}" class="ui-datepicker-input u-text2 invalidDt"/></td>
<td class="center">
<input type="hidden" name="partnerProducts[${index}].id" value="${partner[1].id}" />
<a class="sbmit" date-id="${partner[1].id}" value="${partner[0].no}${index}" style="cursor: hand;cursor: pointer;">保存</a>
<!-- | <@ui.auth code='/product/abateStockProduct.do'><a class="abate" value="${partner[1].id}" style="cursor: hand;cursor: pointer;">失效</a></@ui.auth> -->
</td>
</tr>
<#assign index=index +1 />
</#list>
</#if>
@RequestMapping(value = "/radixAdjustAll.do", method = RequestMethod.POST)
@ResponseBody
public String radixAdjustAll(PartnerProduct partnerproduct) {
try {
service.updateRadixAdjustAll(partnerproduct.getPartnerProducts());
return "true";
} catch (Exception e) {
e.printStackTrace();
return "false";
}
}
SpringMvc參数的接受以及serializeArray的使用方法的更多相关文章
- springMVC參数传递
本文是本人在学习网络视屏springMVC的过程中的学习笔记. 为了更便于理解我决定从实际使用的角度解释. 我们在浏览器输入地址 http://localhost:8080/springMVC6/us ...
- ajax日期參数格式问题
今天遇到ajax传输日期參数后台无法识别的问题,错误异常例如以下. 从异常中能够看出传输到后台的日期数据格式为Thu Aug 13 2015 19:45:20 GMT+0800 (中国标准时间),这样 ...
- Hadoop Ls命令添加显示条数限制參数
前言 在hadoop的FsShell命令中,预计非常多人比較经常使用的就是hadoop fs -ls,-lsr,-cat等等这种与Linux系统中差点儿一致的文件系统相关的命令.可是细致想想,这里还是 ...
- C# 多线程參数传递
1.通过实体类来传递(能够传递多个參数与获取返回值),demo例如以下: 须要在线程中调用的函数: namespace ThreadParameterDemo { public class Funct ...
- 一起talk C栗子吧(第一百二十七回:C语言实例--查看main函数的參数)
各位看官们,大家好,上一回中咱们说的是static关键字的样例,这一回咱们说的样例是:查看main函数的參数.闲话休提,言归正转.让我们一起talk C栗子吧! 看官们.我们在第五十七回中介绍过mai ...
- JVM、垃圾回收、内存调优、常见參数
一.什么是JVM JVM是Java Virtual Machine(Java虚拟机)的缩写.JVM是一种用于计算设备的规范.它是一个虚构出来的计算机,是通过在实际的计算机上仿真模拟各种计算机功能来实现 ...
- 【Jquery】jQuery获取URL參数的两种方法
jQuery获取URL參数的关键是获取到URL,然后对URL进行过滤处理,取出參数. location.href是取得URL.location.search是取得URL"?"之后的 ...
- [javase学习笔记]-6.5 类类型參数与匿名对象
这一节我们来说说类类型參数和匿名对象. 我们继续用之前的小汽车类吧 class Car { int num;//这是轮胎数属性 String color;//这是颜色属性 String brand;/ ...
- springmvc学习笔记(13)-springmvc注解开发之集合类型參数绑定
springmvc学习笔记(13)-springmvc注解开发之集合类型參数绑定 标签: springmvc springmvc学习笔记13-springmvc注解开发之集合类型參数绑定 数组绑定 需 ...
随机推荐
- 【bzoj4889】[Tjoi2017]不勤劳的图书管理员 树状数组+分块+二分
题目描述(转自洛谷) 加里敦大学有个帝国图书馆,小豆是图书馆阅览室的一个书籍管理员.他的任务是把书排成有序的,所以无序的书让他产生厌烦,两本乱序的书会让小豆产生这两本书页数的和的厌烦度.现在有n本被打 ...
- haskell 乱搞(2)之 Y-conbinator [原创]
Y-conbinator"有没有用"?并没有,在大多数支持函数式编程的语言里,你可以自由的使用递归,而这货只是作为理论基石弥散在函数式编程的血肉之中 这是数学笔记,这是数学笔记,这 ...
- LA 3263 平面划分
Little Joey invented a scrabble machine that he called Euler, after the great mathematician. In his ...
- 等价表达式(codevs 1107 答案错误)
题目描述 Description 明明进了中学之后,学到了代数表达式.有一天,他碰到一个很麻烦的选择题.这个题目的题干中首先给出了一个代数表达式,然后列出了若干选项,每个选项也是一个代数表达式,题目的 ...
- Nginx反向代理新篇-使用location对多个URL做反向代理
1.原理 Nginx解析location/后面的字符串,配置不同的字符串匹配不同的URL进行反向代理. 2.nginx.conf配置文件 worker_processes 1; events { wo ...
- android控件-images
1.imageButton 图片按钮 <ImageButton android:id="@+id/imageButton" android:layout_width=&quo ...
- 数学知识巧学JCF(Java Collections framework)
不知你是否还记得高中我们学过的集合,映射,函数,数学确实很牛逼,拿它来研究java集合类,轻而易举的就把知识理解了.本篇文章适合初学java集合类的小白,也适合补充知识漏缺的学习者,同时也是面试者可以 ...
- 转:CEF嵌入到单文档mfc
1.下载: http://www.magpcss.net/cef_downloads/下载cef binary 1.1364.1123 windows.zip(可能要FQ,百度goagent教程,最好 ...
- 转:HtmlCxx用户手册
1.1 简介 使用由KasperPeeters编写的强大的tree.h库文件,可以实现类似STL的DOM树遍历和导航. 打包好的Css解析器. 看似很像C++代码的C++代码(其实已不再是C++了) ...
- Linux线上系统程序debug思路及方法
http://blog.csdn.net/wangzuxi/article/details/44766221