Action中的方法
public String execute3() throws Exception{
String HQL = "from DeliverBill where customer.id="+id;
list = this.getDeliverBillService().findByHQL(HQL);

return SUCCESS;
}jsp页面<tr>     
    
<td width="24%">客户名称:${  }</td>
<td width="24%">总额:${  }</td>    
<td width="24%">付款:${  ]}</td>          </tr>
 <tr>
<td width="24%">
欠款:${  }     
</td>
<td width="24%">
       日期:${  }
</td>
<td width="24%">
      是否审核:${  }
</td>
<td width="24%">
      库管:${   }
</td>
</tr>
    
<tr style="height: 30px" class="">
<td width="24%">
出库负责人:${   }     
  </td>
<td width="24%">
收货人:${  }
</td>
<td width="24%">
         开票人:${  }
</td>
        <td width="84%" colspan="3">
         备注:${    ]}
</td>
</tr>

解决方案 »

  1.   

    不用循环怎么取
    我看你hql查的是单条记录
    你可以在action里直接传对象过去
    private DeliverBill deliverBill;
    if(list.size() != 0)
      deliverBill = (DeliverBill)list.get(0);
    再加个set()方法jsp页面:${deliverBill.属性}
      

  2.   

    怎么加set方法啊?初学不大懂。。谢谢!!!
      

  3.   

    对 对象deliverBill 进行set,get public DeliverBill getDeliverBill() {
    return deliverBill;
    } public void setDeliverBill(DeliverBill deliverBill) {
    this.deliverBill = deliverBill;
    }
      

  4.   

    在action里面上对象deliverBill的set,get方法
            public DeliverBill getDeliverBill() {
    return deliverBill;
    } public void setDeliverBill(DeliverBill deliverBill) {
    this.deliverBill = deliverBill;
    }
    在struts2中主要还是set方法起作用,get方法加不加没多大关系
      

  5.   

    你的list只有一个DeliverBill
    就在action这么写, 
    private DeliverBell deliverBell;public DeliverBill getDeliverBill() {
    return deliverBill;
    }
    public void setDeliverBill(DeliverBill deliverBill) {
    this.deliverBill = deliverBill;
    }
    修改execute3()方法
    public String execute3() throws Exception{
    String HQL = "from DeliverBill where customer.id="+id;
    list = this.getDeliverBillService().findByHQL(HQL);
    deliverBill=(DeliverBill)list.get(0);
    return SUCCESS;
    }
    前台页面可以这么取
    <td>${deliverBill.id}</td>
    或者<td><s:property value="deliverBill.id"/></td>