在不是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 ...
随机推荐
- IE下png图片黑边问题
png图片在ie8下有黑色边框的情况想必大家都有遇到过吧,那么该怎么解决呢?其实很简单,下面的方法或许对大家有所帮助 background-image:url(******.png)!importan ...
- css新奇技术及其未来发展
1.图像替换技术: 图像替换技术是指使用图像替换页面中文本的功能,类似与在页面中插入图像,只是这种方法更为方便,易于代码管理.通常来说,设计者习惯使用有意义的图像去替换一些标题,logo和某些特定的页 ...
- 当css样式表遇到层2
9.定制层的display属性:层的表现是通过框这种结构来实现的.框可以是块级对象也可以是行内对象. Display属性就是用来控制其中内容是块级还是行级.定义为block则为kuai块级,inlin ...
- MySQL5.5升级到5.6
5.6的新的特性 .支持GTIDs,Failover.多线程复制. 新增binlog_row_image只记录row格式下所用字段的修改(而不是像以前一样记录全部列),节省空间等资源: master. ...
- solr 常见异常
solr4.3本地数据提交异常分析 (2013-06-19 16:03:15) 转载▼ 异常一. Exception in thread "main" java.lang.No ...
- VS配置本地IIS以域名访问
1.IIS下配置自己的网站,添加主机名 2.修改hosts文件(C://Windows/System32/drivers/etc) 3.VS中配置项目Web服务器(选择外部主机)
- AJPFX总结jvm运行时内存分布
jvm的运行过程中将java程序运行时数据区分为以下几个部分: (1)程序计数器:存储虚拟机字节码执行的地址 (2)java虚拟机栈:java方法运行时的局部变量表,操作数栈,方法出口等 ( ...
- CF749D Leaving Auction
题目链接: http://codeforces.com/problemset/problem/749/D 题目大意: 一场拍卖会,共n个买家.这些买家共出价n次,有的买家可能一次都没有出价.每次出价用 ...
- Long time no blogging
It is a long time before I posted the last blog on myspace and seems that all of my blogs/documents ...
- 【HEVC帧间预测论文】P1.6 A Fast HEVC Inter CU Selection Method Based on Pyramid Motion Divergence
A Fast HEVC Inter CU Selection Method Based on Pyramid Motion Divergence <HEVC标准介绍.HEVC帧间预测论文笔记&g ...