前端c標籤foreach傳值給後臺
阿新 • • 發佈:2018-11-14
前端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");