日期:2014-05-17 浏览次数:20841 次
package com.actions; import java.util.List; import javax.annotation.Resource; import com.dao.interfaceImp.BasicUserDaoImp; import com.xu.model.BasicUser; public class showAllUsers { private BasicUserDaoImp budi; private List<BasicUser> bus; public BasicUserDaoImp getBudi() { return budi; } @Resource(name="BasicUserDaoImp") public void setBudi(BasicUserDaoImp budi) { this.budi = budi; } public List<BasicUser> getBus() { return bus; } public void setBus(List<BasicUser> bus) { this.bus = bus; } public String execute(){ try{ List<BasicUser> bus = budi.findAllBasicUser(); return "success"; } catch (Exception e){ e.printStackTrace(); return "input"; } } }
<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%> <%@ taglib prefix="s" uri="/struts-tags" %> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>My JSP 'showAllBasicUser.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body> <table> <s:iterator value="bus" id="bs"> <tr> <td> <s:property value="bs.id"/> </td> <td> <s:property value="bs.username"/> </td> <td> <s:property value="bs.branchBankName"/> </td> </tr> </s:iterator> </table> <s:debug/> </body> </html>
public String execute(){ try{ bus = budi.findAllBasicUser(); return "success"; } catch (Exception e){ e.printStackTrace(); return "input"; } }
------解决方案--------------------
List<BasicUser> bus = budi.findAllBasicUser();
红色部分删掉就行了。
------解决方案--------------------
+1 就是这个意思