jsp页面:
<body id="pa"ge>
<h2>客户资料信息</h2> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr>
<th>客户管理员帐号</th>
<th>密码</th>
<th>姓名</th>
<th>创建时间</th>
<th>备注</th>
<th>操作</th>
</tr>
<s:iterator value="clientUsers" var="list">
<tr>
<td><s:property value="#list.CUusername"/></td>
<td><s:property value="#list.CUpassword"/></td>
<td><s:property value="#list.CUname"/></td>
<td><s:property value="#list.CUtime"/></td>
<td><s:property value="#list.CUre"/></td> <td><button>删除</button>
<button>重置</button></td>
</tr>
</s:iterator>
</table>
</body>acton:
public class ViewClientUserAction extends ActionSupport{
private List<ClientUserBean> clientUsers;
private SystemUserManager SUmanger; public SystemUserManager getSUmanger() {
return SUmanger;
} public void setSUmanger(SystemUserManager sUmanger) {
SUmanger = sUmanger;
} public List<ClientUserBean> getA() {
return this.clientUsers;
} public void setA(List<ClientUserBean> clientUsers) {
this.clientUsers = clientUsers;
}

public String list() throws Exception{
clientUsers = SUmanger.getClientUsers();
System.out.println(clientUsers.size());//这里打印出 3
if(clientUsers.size()>=1){
return SUCCESS;
}
return ERROR;
}
}s:iterator总是迭代不出数据。。这是怎么回事啊

解决方案 »

  1.   

    不用var <s:property value="#list.CUusername"/> value里边直接写属性试试
      

  2.   

    在action里clientUsers
    没有getClientUsers方法
    试试这个
    <s:iterator value="a" var="list">
      

  3.   

    如果struts.xml没有配置错的话 试试这个
    <s:iterator value="%{a}" var="list">
    <s:property value="list.CUusername"/> 
      

  4.   

    用  <s:iterator value="a" var="list"> 你 set get 方法
      

  5.   

    在list方法中试试 request.setAttribute("clientUsers",clientUsers);
      

  6.   

    private List<ClientUserBean> clientUsers;必须得有get,set方法
    又或者5楼那样也可以
      

  7.   

    如果你的struts.xml配置文件中没有配置错的话,在ViewClientUserAction 类的clientUsers属性加上get和set方法就ok了
      

  8.   

    你确定不是
    <s:iterator value="#request.clientUsers" var="list">
    ???
      

  9.   

    给楼主一个建议:
    <td><s:property value="#list.CUusername"/></td>
     <td><s:property value="#list.CUpassword"/></td>
     <td><s:property value="#list.CUname"/></td>
     <td><s:property value="#list.CUtime"/></td>
     <td><s:property value="#list.CUre"/></td>
    这里面的CUusername,CUpassword ...这些成员变量名尽量不要大写哦。
      

  10.   

    把这个两个方法:
    public List<ClientUserBean> getA() {
    return this.clientUsers;
    }public void setA(List<ClientUserBean> clientUsers) {
    this.clientUsers = clientUsers;
    }
    改为:
    public List<ClientUserBean> getClientUsers() {
    return this.clientUsers;
    }public void setClientUsers(List<ClientUserBean> clientUsers) {
    this.clientUsers = clientUsers;
    }
      

  11.   

    其实,你可以这么做。
    1、先在类里取值得地方,打印想看看,确定真的取到值了
    2、看看你的jsp页面上是否导入<s:/>标签(这个很重要)
    3、在类里用request.setA..().绑定一个值,然后在jsp页面显示下,确定你页面跳的是对的