日期:2014-05-18  浏览次数:20800 次

jsp首页自动加载数据,数据库二进制图片数据输出到jsp页面
这是jsp页面代码
<body >
             <div>
                  <h4 align="center">所有商品</h4>
                  <s:iterator value="#request.usedgoods" id="usedgood">
                        <div class="xh5">
                            <img height="150" width="120" src="<s:property value="#usedgood.picture"/>"/><br/>
                            <s:property value="#usedgood.goodsname"/><br/>
                             价格:<s:property value="#usedgood.price"/><br/>
                            <form action="addshopping.action" method="post">
                                <input type="image" name="submit" src="/secondhand/picture/car.jpg"/>
                            </form>
                        </div>
                  </s:iterator>
             </div>
          </s:action>
  </body>
这是action的代码
 public String execute() throws Exception{
                   List usedgoods=loadService.getUsedgood();     
                   Map request=(Map)ActionContext.getContext().get("request");
                   request.put("usedgoods", usedgoods);
                   return SUCCESS;
             }
这是dao的代码
package org.dao;
import java.util.List;
import org.model.Usedgood;
public interface LoadDao {
           public List getUsedgood();
}
这是daoimp的代码
package org.dao.imp;
import java.util.List;
import org.dao.LoadDao;
import org.hibernate.Query;
import org.hibern