需求:从页面提交一个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的使用方法的更多相关文章

  1. springMVC參数传递

    本文是本人在学习网络视屏springMVC的过程中的学习笔记. 为了更便于理解我决定从实际使用的角度解释. 我们在浏览器输入地址 http://localhost:8080/springMVC6/us ...

  2. ajax日期參数格式问题

    今天遇到ajax传输日期參数后台无法识别的问题,错误异常例如以下. 从异常中能够看出传输到后台的日期数据格式为Thu Aug 13 2015 19:45:20 GMT+0800 (中国标准时间),这样 ...

  3. Hadoop Ls命令添加显示条数限制參数

    前言 在hadoop的FsShell命令中,预计非常多人比較经常使用的就是hadoop fs -ls,-lsr,-cat等等这种与Linux系统中差点儿一致的文件系统相关的命令.可是细致想想,这里还是 ...

  4. C# 多线程參数传递

    1.通过实体类来传递(能够传递多个參数与获取返回值),demo例如以下: 须要在线程中调用的函数: namespace ThreadParameterDemo { public class Funct ...

  5. 一起talk C栗子吧(第一百二十七回:C语言实例--查看main函数的參数)

    各位看官们,大家好,上一回中咱们说的是static关键字的样例,这一回咱们说的样例是:查看main函数的參数.闲话休提,言归正转.让我们一起talk C栗子吧! 看官们.我们在第五十七回中介绍过mai ...

  6. JVM、垃圾回收、内存调优、常见參数

    一.什么是JVM JVM是Java Virtual Machine(Java虚拟机)的缩写.JVM是一种用于计算设备的规范.它是一个虚构出来的计算机,是通过在实际的计算机上仿真模拟各种计算机功能来实现 ...

  7. 【Jquery】jQuery获取URL參数的两种方法

    jQuery获取URL參数的关键是获取到URL,然后对URL进行过滤处理,取出參数. location.href是取得URL.location.search是取得URL"?"之后的 ...

  8. [javase学习笔记]-6.5 类类型參数与匿名对象

    这一节我们来说说类类型參数和匿名对象. 我们继续用之前的小汽车类吧 class Car { int num;//这是轮胎数属性 String color;//这是颜色属性 String brand;/ ...

  9. springmvc学习笔记(13)-springmvc注解开发之集合类型參数绑定

    springmvc学习笔记(13)-springmvc注解开发之集合类型參数绑定 标签: springmvc springmvc学习笔记13-springmvc注解开发之集合类型參数绑定 数组绑定 需 ...

随机推荐

  1. Python之静态语法检查

    Python是一门动态语言.在给python传参数的时候并没有严格的类型限制.写python程序的时候,发现错误经常只能在执行的时候发现.有一些错误由于隐藏的比较深,只有特定逻辑才会触发,往往导致需要 ...

  2. 【Luogu】P3387缩点(Tarjan缩点+深搜DP)

    题没什么好说的,因为是模板题.求值我用的是dfs. 不能直接在原图上dfs,因为原图上有环的话会发生一些滑稽的事情.所以我们要用Tarjan缩点.因为此题点权全为正,所以如果在图上走一个环当然可以全走 ...

  3. python 写excal

           workbook.save(filename)

  4. sqlite-jdbc

    sqlite-jdbc驱动下载 https://bitbucket.org/xerial/sqlite-jdbc/downloads import java.sql.*; public class T ...

  5. spring两个核心IOC、AOP

    Spring是一个开放源代码的设计层面框架,他解决的是业务逻辑层和其他各层的松耦合问题,因此它将面向接口的编程思想贯穿整个系统应用.Spring是于2003 年兴起的一个轻量级的Java 开发框架,由 ...

  6. bzoj1734 [Usaco2005 feb]Aggressive cows 愤怒的牛 二分答案

    [Usaco2005 feb]Aggressive cows 愤怒的牛 Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 407  Solved: 325[S ...

  7. mysql语句优化方案(网上流传)

    关于mysql处理百万级以上的数据时如何提高其查询速度的方法 最近一段时间由于工作需要,开始关注针对Mysql数据库的select查询语句的相关优化方法. 由于在参与的实际项目中发现当mysql表的数 ...

  8. Andrew Stankevich's Contest (21) J dp+组合数

    坑爹的,,组合数模板,,, 6132 njczy2010 1412 Accepted 5572 MS 50620 KB C++ 1844 B 2014-10-02 21:41:15 J - 2-3 T ...

  9. msp430项目编程46

    msp430综合项目---监控系统46 1.电路工作原理 2.代码(显示部分) 3.代码(功能实现) 4.项目总结

  10. Python入门--12--函数与变量

    python只有函数没有过程 函数有运行完了之后会有返回值.过程没有 def back(): return 1,'gg',2 #会有返回值(1,'gg',2) #注意默认返回元祖 一.全局和局部变量 ...