日期:2014-05-18 浏览次数:20706 次
<s:iterator value="#request.productAttr" var="temp">
<td><table width="30%" border="0">
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td rowspan="4"><img src="/img2/<s:property value="#temp.pPhoto"/>"></td>
<td>名称:<s:property value="#temp.proName"/></td>
</tr>
<tr>
<td>价格:<s:property value="#temp.pPrice"/></td>
</tr>
<tr>
<td>单位:<s:property value="#temp.proUnit"/></td>
</tr>
<tr>
<td>折扣:<s:property value="#temp.pCount"/></td>
</tr>
<tr>
<td colspan="2">简介:<s:property value="#temp.pIntroduce"/></td>
</tr>
</table></td>
</s:iterator>
public String showProduct(){
ProductDao dao=new ProductDao();
ArrayList<Product> al=dao.showProduct();
request.put("productAttr", al);
return "ok";
}
public ArrayList<Product> showProduct(){
ArrayList<Product> al=new ArrayList<Product>();
String sql="select * from product_table";
JDBCTool dbhelper = JDBCToolCreator.createJDBCTool();
ResultSet rs=dbhelper.search(sql);
try {
while(rs.next()){
Product pt=new Product();
pt.setProId(rs.getString(1));
pt.setPc1Id(rs.getString(2));
pt.setPc2Id(rs.getString(3));
pt.setProName(rs.getString(4));
pt.setProUnit(rs.getString(5));
pt.setpPrice(rs.getString(6));
pt.setpCount(rs.getString(7));
pt.setpVender(rs.getString(8));
pt.setpIntroduce(rs.getString(9));
pt.setpDate(rs.getString(10));
pt.setpPhoto(rs.getString(11));
al.add(pt);
}