JSP页面无法显示数据库中取出的值,但在测试中可以输出,高手解答

JSP界面的代码:

<%@page import="Models.Flow"%>
<%@page import="Models.FlowImpl"%>
<%@page import="java.util.*"%>
<%@page import="java.util.ArrayList"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<title>学生信息列表</title>

</head>
<body>
<table bgcolor=lightgrey>
<tr><td>流水单号</td><td>交易额</td><td>优惠交易额</td><td>日期</td><td>删除</td><td>修改</td></tr>
<%FlowImpl fl = new FlowImpl(); ;
ArrayList<Flow> flows = fl.getAllFlow();
for(Flow f:flows)
{%>
<tr bgcolor=cyan><td><a href="/Xs/servlet/ToDditFlow?id=<%=f.getId() %>"><%=f.getId() %></a></td>
<td><%=f.getPrice() %></td>
<td><%=f.getFprice() %></td>
<td><%=f.getDate() %></td>
<td> <a href="/Xs/servlet/DoDeleteFlow?id=<%=f.getId()%>"> 删除</a> </td>
<td><a href="/Xs/servlet/ToDditFlow?id=<%=f.getId() %>">修改</a></td>
</tr>

<%
}
%>
<tr><td><a href="/Xs/addFlow.jsp">添加流水单</a></td></tr>

</table>
<form method="post" action="/Xs/servlet/DoFindFlowById">
<table>
<tr> <td><input type="text"name="idsearch"></td>
<td> <input type="submit" name="searchbyid"value="流水单号查找">
<input type="submit"name="searchwithid"value="模糊查询">
</td>
</tr>
</table>
</form>
<form method="post"action="/Xs/servlet/DoFindFlowWithCombo">
<table>
<tr><td><input type="text"name="content1"></td><td><input type="text"name="content2"></td>
<td><input type="submit"value="组合查询"></td></tr>

</table>
</form>

</body>
</html>

测试的代码:
package Models;

import java.util.ArrayList;

public class Test {

public static void main(String[] args)
{
FlowImpl fl = new FlowImpl();
ArrayList<Flow> flows = fl.getAllFlow();
for(Flow f:flows)
{
System.out.println(f.getId());
System.out.println(f.getPrice());
System.out.println(f.getFprice());
System.out.println(f.getDate());
}

}

}

第1个回答  2014-05-14
for(Flow f:flows)
{
out.println("<tr bgcolor=cyan><td><a href=\"/Xs/servlet/ToDditFlow?id="+f.getId() +"\">"+f.getId() +"</a></td><td>"+f.getPrice()+ "</td><td>"+f.getFprice() +</td><td>"+f.getDate()+" </td><td> <a href=\"/Xs/servlet/DoDeleteFlow?id="+f.getId()+"\"> 删除</a> </td><td><a href=\"/Xs/servlet/ToDditFlow?id="+f.getId() +"\">修改</a></td></tr>)
}
试试这么写FOR
第2个回答  2014-05-14
页面有没有报错追问

没有

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网