form表單如何提交list集合到伺服器實現資料互動
阿新 • • 發佈:2021-06-21
<form action="${list}" method="get" name="ProductForm" id="theProductForm" class="#"> <%-- action:表單提交時向${list}傳送表單資料 method:表單資料提交方式 name :控制表單控制元件 id :區別不同的表單控制元件 class : 指定表格css樣式類 --%> <table border="1" cellpadding="0" cellspacing="0" width="50%"> <tr> <th>商品編號</th> <th>商品名稱</th> <th>商品價格</th> <th>商品產地</th> <th>操作</th> </tr> <tr> <!-- jstl jsp裡寫java (T_T) forEach遍歷list--><c:forEach var="product" items="${list}"> <td>${product.id}</td> <td>${product.name}</td> <td>${product.price}</td> <td>${product.address}</td> <td> <ahref="#">刪除</a> </td> </tr> </c:forEach> </table> </form>
又是一個小細節:
el表示式在jsp裡單行註釋裡仍有效(果然哪都能寫),但是在多行註釋裡失效
<!-- ${list} --> <%-- 當action表單提交時向${list}傳送表單資料 --%>