<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> <a href="#">刪除</a> </td> </tr> </c:forEach> </table> </form>
又是一個小細節:
el表達式在jsp里單行注釋里仍有效(果然哪都能寫),但是在多行注釋里失效
<!-- ${list} --> <%-- 當action表單提交時向${list}發送表單數據 --%>