代码如下,用注释掉的Java小脚本就能输出,好像应该叫JSP脚本。麻烦各位给我看看用el和jstl为什么不能输出,哪里错了。
<%@page import="cn.pb.news.entity.Bill"%>
<%@page import="java.util.List"%>
<jsp:useBean id="billService" class="cn.pb.news.service.impl.BillServiceImpl" scope="page"/>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link type="text/css" rel="stylesheet" href="../css/style.css"/>
<title>Insert title here</title>
</head>
<body>
<div class="menu">
<form method="get" action="">
商品名称:<input type="text" name="productName" class="input-text" />
是否付款:<select name="payStatus">
<option value="">请选择</option>
<option value="1">已付款</option>
<option value="0">未付款</option>
</select>
<input type="submit" name="submit" value="组合查询" class="button" />
</form>
</div>
<div class="main">
<div class="optitle clearfix">
<em><input type="button" name="button" value="添加数据" class="input-button" onclick="location.href='modify.jsp'" /></em>
<div class="title">账单管理>></div>
</div>
<div class="content">
<table class="list">
<tr>
<td>账单编号</td>
<td>商品名称</td>
<td>商品数量</td>
<td>交易金额</td>
<td>是否付款</td>
<td>供应商名称</td>
<td>商品描述</td>
<td>账单时间</td>
</tr>
<%
// BillService billService = new BillServiceImpl();
List<Bill> billList = billService.getBillList();
// for(Bill bill : billList) {
request.setAttribute("billList", billList);
%>
<c:forEach items="${requestScope.billList }" var="bill">
<tr>
<!-- <td><%=bill.getId()%></td> -->
<!-- <td><%=bill.getProductName()%></td> -->
<!-- <td><%=bill.getCounts() %></td> -->
<!-- <td><%=bill.getBillMoney() %></td> -->
<!-- <td><%=bill.getIsPay() %></td> -->
<!-- <td><%=bill.getProductName() %></td> -->
<!-- <td><%=bill.getProductDesc() %></td> -->
<!-- <td><%=bill.getBillTime() %></td> -->
<td>${bill.Id }</td>
<td>${bill.productName }</td>
<td>${bill.counts }</td>
<td>${bill.billMoney }</td>
<td>${bill.isPay }</td>
<td>${bill.productName }</td>
<td>${bill.productDesc }</td>
<td>${bill.billTime }</td>
</tr>
</c:forEach>
<!-- <tr> -->
<!-- <td><%=bill.getId()%></td> -->
<!-- <td><%=bill.getProductName()%></td> -->
<!-- <td><%=bill.getCounts() %></td> -->
<!-- <td><%=bill.getBillMoney() %></td> -->
<!-- <td><%=bill.getIsPay() %></td> -->
<!-- <td><%=bill.getProductName() %></td> -->
<!-- <td><%=bill.getProductDesc() %></td> -->
<!-- <td><%=bill.getBillTime() %></td> -->
<!-- </tr> -->
<!-- <% -->
<!-- } -->
<!-- %> -->
</table>
</div>
</div>
</body>
</html>
慕大叔
fenkapian
相关分类