Bind the data of the form to the List

<c:forEach items="${itemList }" var="item" varStatus="s">
<tr>
    <td><input type="checkbox" name="ids" value="${item.id}"/></td>
    <td>
        <input type="hidden" name="itemList[${s.index}].id" value="${item.id }"/>
        <input type="text" name="itemList[${s.index}].name" value="${item.name }"/>
    </td>
    <td><input type="text" name="itemList[${s.index}].price" value="${item.price }"/></td>
    <td><input type="text" name="itemList[${s.index}].createtime" value="<fmt:formatDate value="${item.createtime}" pattern="yyyy-MM-dd HH:mm:ss"/>"/></td>
    <td><input type="text" name="itemList[${s.index}].detail" value="${item.detail }"/></td>
    
    <td><a href="${pageContext.request.contextPath }/itemEdit.action?id=${item.id}">修改</a></td>

</tr>
</c:forEach>

${current} the item (of the collection) for the current iteration
${status.first} determines whether the current item is the first item in the collection, the return value is true or false
${status.last} determines whether the current item is the last item in the collection
The common parameters of the varStatus attribute are summarized as follows:
${status.index} output line number, starting from 0.
${status.count} output line number, starting from 1.
${status. The next item, the return value is true or false
begin, end, and step respectively represent: the starting sequence number, the ending sequence number, and the jumping step.

  

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325341321&siteId=291194637