在不是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 ...
随机推荐
- htm5 + ajax 文件上传
好文 http://www.cnblogs.com/morlin/p/4930822.html 后台接收 FormData 的参数一直为空,将jquery改为最高版本,问题解决.测试发现IE10以上才 ...
- django接受表单
from django.shortcuts import render from django.shortcuts import HttpResponse import os # Create you ...
- SQL 实战语句(9)
1.如何同步根据部门表同步另外一个项目表的部门字段 update A set A.auditownerid=(select lp.epleaderId from (select ep.userid a ...
- JavaScript-页面打印正方形,各种三角形与菱形
一. 正方形 a) 在第一个for循环中控制,一共输出几行.依靠的是,每次输出一行,就会在后面输出一个换行符<br>; b) 在第二个for循环中控制每行输出几个五角星.这样的 ...
- 题解报告:poj 2631 Roads in the North(最长链)
Description Building and maintaining roads among communities in the far North is an expensive busine ...
- Appium + Python自动化 - 元素定位uiautomatorviewer
元素定位主要介绍如何使用uiautiomatorviewer,通过定位到页面上的元素,然后进行相应的点击等操作.uiautiomatorviewer是android-sdk自带的一个元素定位工具,非常 ...
- 508 Most Frequent Subtree Sum 出现频率最高的子树和
详见:https://leetcode.com/problems/most-frequent-subtree-sum/description/ C++: /** * Definition for a ...
- maven-ali镜像网站setting.xml
简述 使用maven管理jar包的时候,有可能会有网络限制,要解决的这个问题的话可以使用ali的镜像网站. 创建文件 创建settings.xml,内容如下 <settings xmlns=&q ...
- 【学习笔记】深入理解js原型和闭包(6)——继承
为何用“继承”为标题,而不用“原型链”? 原型链如果解释清楚了很容易理解,不会与常用的java/C#产生混淆.而“继承”确实常用面向对象语言中最基本的概念,但是java中的继承与javascript中 ...
- laravel学习笔记(一)
laravel 简述 优点:优雅.简洁.工程化(项目架构,协同开发) 版本:2011 June 1.0 ,LTS(long time) ,laravel 5.4 功能:队列.搜索.数据库搜索.定时脚本 ...