显示数据列表

jsp页面:

<c:forEach items="${books}" var="b">
	<tr onmouseover="this.style.backgroundColor = 'white'" onmouseout="this.style.backgroundColor = '#F5FAFE';">
	  <td style="CURSOR: hand; HEIGHT: 22px" align="center" width="23">${b.cId }</td>
	  <td style="CURSOR: hand; HEIGHT: 22px" align="center" width="18%">${b.cName}</td>
	  <td style="CURSOR: hand; HEIGHT: 22px" align="center" width="8%">${b.cPrice }</td>
	  <td style="CURSOR: hand; HEIGHT: 22px" align="center" width="8%">${b.cCount }</td>
	  <td style="CURSOR: hand; HEIGHT: 22px" align="center">${b.cCategory }</td>
	  <td align="center" style="HEIGHT: 22px" width="7%">
		 <a href="${pageContext.request.contextPath}/admin/products/edit.jsp">
		 <img src="${pageContext.request.contextPath}/admin/images/i_edit.gif" border="0"
style="CURSOR: hand"> 
		 </a>
	  </td>
      <td align="center" style="HEIGHT: 22px" width="7%">
		<a href="#">
		<img src="${pageContext.request.contextPath}/admin/images/i_del.gif" width="16"
height="16" border="0" style="CURSOR: hand">
		</a>
	  </td>
	</tr>
</c:forEach>

表单提交方式:

<form id="Form1" name="Form1" 
action="${pageContext.request.contextPath}/servlet/findBookListServlet" method="post">
</form>

servlet代码:

@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
 throws ServletException, IOException {
		req.setCharacterEncoding("UTF-8");
		List<Commodity> bookList = service.getBookList();
		if (bookList!=null) {
			req.setAttribute("books", bookList);
			req.getRequestDispatcher("/admin/products/list.jsp").forward(req, resp);
		}else {
			req.getRequestDispatcher("/admin/products/list.jsp").forward(req, resp);
		}
		
	}

效果是这样滴:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值