jsp 传递list对象时需要注意的小细节
来源:互联网 发布:r语言导入csv数据 编辑:程序博客网 时间:2024/06/06 17:18
对于list 有两个及以上的相同div 里面布局如:
<div>
<ul class="inline">
<li>
<label>姓名:</label>
<input type="text" id="zname" class="zname">
</li>
</ul>
</div>
var psrz = [];
$("#ruzhuCustomerList div").each(function (i, n) {
psrz.push({
cName: $(this).find(document.getElementById(".zname")).val(),
cPhone: $(this).find(document.getElementById("zphone")).val(),
cCertificatetype: $(this).find(document.getElementById("certificatetype")).val(),
cCertificatenumber: $(this).find(document.getElementById("certificatenumber")).val(),
cBirthday: $(this).find(document.getElementById("zbirthday")).val(),
cSex: $(this).find(document.getElementById("rzsex")).val(),
cNativeplace: $(this).find(document.getElementById("nativeplace")).val(),
cAddress: $(this).find(document.getElementById("zaddress")).val()
});
});
return psrz;
当你如上这样传递参数时,发现无论list的长度是多少, 你后台获取的数据只有一个对象,其他显示{},{} 空 ,那么怎么解决这个问题呢?
如上:<input type="text" id="zname" class="zname">
我在input标签中加上了一个class 属性 并规范命名
psrz.push({
cName: $(this).find(".zname").val(),
cPhone: $(this).find(".zphone").val(),
cCertificatetype: $(this).find(".certificatetype").val(),
cCertificatenumber: $(this).find(".certificatenumber").val(),
cBirthday: $(this).find(".zbirthday").val(),
cSex: $(this).find(".rzsex").val(),
cNativeplace: $(this).find(".nativeplace").val(),
cAddress: $(this).find(".zaddress").val()
});
再次传递参数,这次就能获取到多个对象 你是否也遇到过这样的问题呢
- jsp 传递list对象时需要注意的小细节
- 使用OpenCV需要注意的小细节
- 使用OpenCV需要注意的小细节
- 界面设计中需要注意的小细节
- 安卓需要注意的小细节
- iOS中需要注意的小细节
- mybatis需要注意的小细节
- Json对象需要注意的一些细节。
- 作为Linux小白,一些需要注意的小细节
- 向list中添加对象时需要注意的问题
- js 常见的一些小问题 需要注意的细节
- 提示框的一些需要注意的小细节
- iOS开发中需要注意的一些小细节
- java编写代码需要注意的小细节
- 初学者-html中button标签需要注意的小细节
- 8点需要注意的Web编程小细节
- 商业拜访需要注意的13个小细节
- Mybatis dao传递参数为List时,需要注意的点
- LINUX 命令 SED
- Caffe在Windows10下的编译安装
- MySQL学习笔记-操作数据表中的记录
- MyBatis之自增长主键值获取
- LeetCode 442. Find All Duplicates in an Array
- jsp 传递list对象时需要注意的小细节
- auto
- 深入理解Java中的final关键字
- ResNet解读
- java发送http的get、post请求
- HDU 1072
- Java并行计算框架Fork/Join
- c++实现三维向量的操作
- 自定义View-轻量级柱状图、饼图、折线图