在不是modelAttribute的情况下,如何保存页面输入值的方法(多行遍历)
<c:forEach var="prdRelInfo" items="${goodRelPrdList}" varStatus="s">
<tr <c:if test="${!(s.index%2==0) }"> class="tdbgcolor"</c:if>>
<td><c:out value="${prdRelInfo.prdGoodId.goodsCode}"/></td>
<td><c:out value="${prdRelInfo.prdGoodId.goodsName}"/></td>
<td><c:out value="${prdRelInfo.prdGoodId.goodsBrand.name}"/></td>
<td>
<c:if test="${prdRelInfo.prdGoodId.skuType eq '1'}">正常产品</c:if>
<c:if test="${prdRelInfo.prdGoodId.skuType eq '2'}">赠品</c:if>
<c:if test="${prdRelInfo.prdGoodId.skuType eq '3'}">附件</c:if>
<c:if test="${prdRelInfo.prdGoodId.skuType eq '4'}">虚拟产品</c:if>
</td>
<td><c:if test="${prdRelInfo.prdGoodId.hasStandPart != null and prdRelInfo.prdGoodId.hasStandPart == '1'}"><a onclick="artDialog({title:'普通商品',url:'goodsInfo.do?actionMethod=viewAccessory&opType=stand&queryId=${prdRelInfo.prdGoodId.id}&specialGoods=true', width:800, height:520,lock:true});" href="#">查看</a></c:if>
<c:if test="${prdRelInfo.prdGoodId.hasStandPart == null or prdRelInfo.prdGoodId.hasStandPart == '2'}">无</c:if>
</td>
<td><c:if test="${prdRelInfo.prdGoodId.hasOptionPart != null and prdRelInfo.prdGoodId.hasOptionPart == '1'}"><a onclick="artDialog({title:'组合商品',url:'goodsInfo.do?actionMethod=viewAccessory&opType=optional&queryId=${prdRelInfo.prdGoodId.id}&specialGoods=true', width:800, height:520,lock:true});" href="#">查看</a></c:if>
<c:if test="${prdRelInfo.prdGoodId.hasOptionPart == null or prdRelInfo.prdGoodId.hasOptionPart == '2'}">无</c:if>
</td>
<c:set var="isShowMain" value="false"/>
<c:forEach var="goodRelPrd" items="${goodMainRelPrdList}">
<c:if test="${goodRelPrd.prdGoodId.id==prdRelInfo.prdGoodId.id}">
<c:set var="isShowMain" value="true"/>
</c:if>
</c:forEach>
<td>
<input type="radio" name="mainPrd" id="mainPrd_${prdRelInfo.prdGoodId.id}" onclick="<c:if test="${goodsInfo.id != null}">if(confirm('确认要设为主商品吗?')){assignAccessorySave('${prdRelInfo.prdGoodId.id}');}</c:if>">
</td>
<c:if test="${goodsInfo.id != null}">
<c:if test="${isShowMain}">
<script language="javascript">
window.setTimeout("showHideButton('${prdRelInfo.prdGoodId.id}','${isShowMain}');",10);
</script>
</c:if>
</c:if>
<td>
<input type="radio" name="assemble_propertyType_${prdRelInfo.prdGoodId.id}" id="assemble_propertyType_${prdRelInfo.prdGoodId.id}_1" value="1" <c:if test="${prdRelInfo.propertyType eq '1'}"> checked="checked"</c:if> onclick="<c:if test="${goodsInfo.id != null}">updatePropertyType(this,'${prdRelInfo.prdGoodId.id}','assemble','${isShowMain}');</c:if>"/>商品
<input type="radio" name="assemble_propertyType_${prdRelInfo.prdGoodId.id}" id="assemble_propertyType_${prdRelInfo.prdGoodId.id}_2" value="2" <c:if test="${prdRelInfo.propertyType eq '2'}"> checked="checked"</c:if> onclick="<c:if test="${goodsInfo.id != null}">updatePropertyType(this,'${prdRelInfo.prdGoodId.id}','assemble','${isShowMain}');</c:if>"/>赠品
</td>
<td width="5%"><input type="text" name="num_${prdRelInfo.id}" value="${prdRelInfo.number}"/></td>
<td><a href="#" onclick="if(confirm('确认要取消商品吗?')){deleteIt(this,'${goodsInfo.id}','${prdRelInfo.prdGoodId.id}');}">取消商品</a></td>
</tr>
</c:forEach>
其中 <td width="5%"><input type="text" name="num_${prdRelInfo.id}" value="${prdRelInfo.number}"/></td> 要将 值写道数据库中
在Controller类中,通过遍历取出多个值
List<PrdRelGoods> prdRelGoodsList2 = goodsInfoService
.getGoodsRelPrd(goodsInfo.getId());
Iterator<PrdRelGoods> iterator=prdRelGoodsList2.iterator();
while(iterator.hasNext())
{
PrdRelGoods prdRelGoods=iterator.next();
//System.out.println("prd_ref_goods_id---------------------->"+prdRelGoods.getId());
int num=Integer.valueOf(request.getParameter("num_"+prdRelGoods.getId()));
prdRelGoods.setNumber(num);
}
在service类中 通过hql语言 获取List
@SuppressWarnings("unchecked")
public List<PrdRelGoods> getGoodsRelPrd(final Long goodsInfoId) {
String sql = "";
if (goodsInfoId == null) {
sql = "from PrdRelGoods t";
return hibernateTemplate.find(sql + " order by t.id asc");
} else {
sql = "from PrdRelGoods t where t.goodsInfo.id=?";
return hibernateTemplate.find(sql + " order by t.id asc",
goodsInfoId);
}
}
在不是modelAttribute的情况下,如何保存页面输入值的方法(多行遍历)的更多相关文章
- Visual c++例子,可不使用常规的对话框资源模板的情况下,动态创建对话框的方法
详细说明:Visual c++例子,可不使用常规的对话框资源模板的情况下,动态创建对话框的方法.该方法可以在运行时在内存中直接建立对话框资源,使用起来更为灵活.适用于多个开发项目共享有界面的公用程序模 ...
- 没有 iOS 开发者账号的情况下部署到真机的方法
原文发表于我的技术博客 本文分享了官方推荐的没有 iOS 开发者账号的情况下部署到真机的方法,供参考. 原文发表于我的技术博客 1. 官方推荐的方法 原文在此,也就是 Ionic 官方团队在博客中分享 ...
- 关于img标签浏览器自带的边框,清除边框的解决方式(即img[src=""] img无路径情况下,灰色边框去除解决方法)
详解img[src=""] img无路径情况下,灰色边框去除解决方法 1.Js解决办法 <html> <head> <meta charset=&qu ...
- 关于在gridview中有dorpdownlist的情况下使用自带编辑模板的方法
今天记录一下在gridview中,如果有dropdownlist的情况下使用gridview自带编辑模式的方法. 好吧,今天的这个问题有点绕,详细解释一下目的. 因为gridview中的某些列的数据是 ...
- ASP.NET在不同情况下实现单点登陆(SSO)的方法
第一种:同主域但不同子域之间实现单点登陆 Form验证其实是基于身份cookie的验证.客户登陆后,生成一个包含用户身份信息(包含一个ticket)的cookie,这个cookie的名字就是在web. ...
- 计算纯文本情况下RichTextBox实际高度的正确方法(.NET)
2016-07-17重大更新 其实有更好.更系统的方法,也是最近才发现的,分享给大家!! /// <summary> /// /// </summary> ...
- linux服务器没网情况下手动安装软件几个方法
1,找到一个有网的服务器,使用yumdownloader gcc,获取需要的rmp包: 2,在http://pkgs.org 下下载所需要的rpm包
- 在没有创建Provision Profile权限的情况下 发布Enterprise inhouse app 的方法
由于用普通开发者证书,发布的app或ipa没法在普通机器上安装运行,原因是apple限制了普通开发者发布appstore以外的环境中,只有Enterprise企业版证书才能发布inhouse. 今天在 ...
- 在yum出问题的情况下安装某个rpm包的方法
1 核心命令 rpm -i 2 方法 centos镜像站去找到所有的rpm包. 安装这个rpm包,发现有一个依赖没有安装,就去下载安装.因为整体的包是有限的,因此终会收敛的. 比如安装rpmbuild ...
随机推荐
- gvim 常用键
按i 切换到插入模式,ESC退出 命令模式下 dd 删除一行 dw 删除一个字 x 删除一个字符 :set num 设置行号 :reg 查看寄存器 p 粘贴 y 复制 "*p 不同环境下 ...
- ie下,php HTTP_REFERER获取失败的整理
HTTP_REFERER有效的情况1.以iframe 形式调用地址2.以window.open调用,打开新页面window.open(url);3.使用window.location.replace在 ...
- java自带线程池
1. newSingleThreadExecutor 创建一个单线程的线程池.这个线程池只有一个线程在工作,也就是相当于单线程串行执行所有任务.如果这个唯一的线程因为异常结束,那么会有一个新的线程来替 ...
- Redis基础知识详解(非原创)
文章大纲 一.Redis介绍二.Redis安装并设置开机自动启动三.Redis文件结构四.Redis启动方式五.Redis持久化六.Redis配置文件详解七.Redis图形化工具八.Java之Jedi ...
- hash系列集合的性能优化
hash系列的集合: HashSet.LinkedHashSet 采用hash算法决定元素在集合中的存储位置 HashMap.LinkedHashMap.Hashtable 采用hash算 ...
- ceph脚本-自动部署计算机节点
依然还在加班中,最近确实忙的脚打后脑勺! 又花了些时间丰富ceph脚本,可以连带着自动部署计算机节点了. 这一部分内容是后加的.可以关注我的公众号获取更多的项目代码和讲解!波神与你同行哦,加油!!!
- 如何在win7、win8、win8.1上安装使用vb6.0
https://jingyan.baidu.com/article/915fc414fdf8fb51384b2062.html如何在win7.win8.win8.1上安装使用vb6.0 如何在win7 ...
- SQL中的笛卡儿积问题和多表连接操作
(使用scott用户) SELECT * FROM scott.dept;--4SELECT * FROM scott.emp;--14 /**笛卡尔积内连接(等值连接)外连接(非等值连接)自连接*/ ...
- /usr/bin/install -c -m 644 sample-config/httpd.conf /etc/httpd/conf.d/nagios.conf
[root@localhost nagios]# make install-webconf/usr/bin/install -c -m 644 sample-config/httpd.conf /et ...
- uva1153 Keep the Customer Satisfied
贪心加优先队列 (默认是小的在前,正好) //这里又很套路,设队列里的都是符合条件的考虑新加入的即可.再处理一下空队列的情况.很完美// 截止时间短的在前面,干的就多先根据截止日期排序优先队列根据完成 ...