jsp显示数据问题
页面代码
<%
ArrayList carList=(ArrayList)request.getAttribute("carList");
if(carList==null||carList.size()==0){
%> <tr height="80"><td colspan="9" align="center">没有数据可显示</td></tr>
<% }
//out.print("<tr><td align='center'>暂无数据可显示</td></tr>");
else
{
int i=0;
while(i<carList.size())
{
JBCar carSingle=(JBCar)carList.get(i);
%>
servlet 代码:
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String action=request.getParameter("action");
if(action==null)
action="";
/*查询车位信息*/
if(action.equals("single"))
this.ListCar(request,response);
}
public void ListCar(HttpServletRequest request, HttpServletResponse response)throws IOException,
ServletException
{ cardao car=new cardao();
List carList=car.queryCar("all");
request.setAttribute("carList", carList);
request.getRequestDispatcher("/admin/carView.jsp").forward(request,response);
}
数据库中有数据 为什么carList总是执行为空。
<%
ArrayList carList=(ArrayList)request.getAttribute("carList");
if(carList==null||carList.size()==0){
%> <tr height="80"><td colspan="9" align="center">没有数据可显示</td></tr>
<% }
//out.print("<tr><td align='center'>暂无数据可显示</td></tr>");
else
{
int i=0;
while(i<carList.size())
{
JBCar carSingle=(JBCar)carList.get(i);
%>
servlet 代码:
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String action=request.getParameter("action");
if(action==null)
action="";
/*查询车位信息*/
if(action.equals("single"))
this.ListCar(request,response);
}
public void ListCar(HttpServletRequest request, HttpServletResponse response)throws IOException,
ServletException
{ cardao car=new cardao();
List carList=car.queryCar("all");
request.setAttribute("carList", carList);
request.getRequestDispatcher("/admin/carView.jsp").forward(request,response);
}
数据库中有数据 为什么carList总是执行为空。
作者: li1037 发布时间: 2011-06-06
断点 debug 看看不就知道了!
作者: wang1986614 发布时间: 2011-06-06