struts显示图片的Action

    技术2022-05-11  73

    public class ProjectShowPictAction extends Action {

     public ActionForward execute(ActionMapping mapping, ActionForm actionform,   HttpServletRequest request, HttpServletResponse response) throws Exception {  String id=request.getParameter("id");   byte[] photo=null;   ProjectDao pd=new ProjectDao();   if(id!=null&&!"".equals(id)){    photo=pd.queryPhoto(id);    if(photo!=null){     response.setContentType("image/*");    response.getOutputStream().write(photo);    response.getOutputStream().close();    }   } return null; }} 


    最新回复(0)