代码改变世界

前端c标签foreach传值给后台

2018-11-14 21:33  CCG波克  阅读(1728)  评论(0编辑  收藏  举报

前端c标签foreach传值给后台

<div style="margin-bottom: 10px">
  <c:forEach items="${goodsList}" var="item" varStatus="status">
  <input id="goodsId" name="goodsId" value="${item.goodsId}"  
data-options="required:true" style="width: 100px" hidden="true" />
  <input id="sectionOneValue" name="sectionOneValue"
value="${item.sectionOneValue}" data-options="required:true"
style="width: 100px; border: none;" />
  <input id="goodsPrice" name="goodsPrice"
value="${item.goodsPrice}" data-options="required:true"
style="width: 100px" />
<br />
</c:forEach>

后台这样接收

String[] goodsId = request.getParameterValues("goodsId");
String[] goodsPrice = request.getParameterValues("goodsPrice");