解决方案 »

  1.   

    <img height="150" width="120" src="<s:property value="#usedgood.picture"/>"/><br/>
    改为<img height="150" width="120" src="XXXX.action?id=${usedgood.picture}"/><br/>
    在XXXX.action中这样写:              if (id!= null) {
    byte[] content = id;
    if (content != null) {
    response.setContentType("image/bmp");
    // response.setContentType("image/jpeg");
                    out.write(content);
    }
    }
                    return null;思路大体是这样的,前提是你的图片是二进制的
      

  2.   

    这样应该可以,要不你就把图片保存到一个临时的路径,然后<img height="150" width="120" src="XXXX.action?id=${usedgood.picture}"/>
    这里的src使用你图片存放的路径位置就可以了。
      

  3.   

    最好是保存为临时文件,这样改动少一些,否则需要修改action中添加方法,而且还要查询2次数据库
      

  4.   

    请问我可以这样写吗?用<s:property>标签
    <img height="150" width="120" src="getImage.action?usedgood.picture=<s:property value="#usedgood.picture"/>"/>
      

  5.   

    public String execute() throws Exception{
      String goodsname=usedgood.getGoodsname();
      List list=searchService.getSearch(goodsname);
    System.out.print(list.size());
    Map request=(Map)ActionContext.getContext().get("request");
    request.put("list",list);
    return SUCCESS;
    }
    上面代码的goodsname是在jsp页面输入的,现在通过searchService.getSearch(goodsname)查出list了,我想问一下怎样才能在本action.java这里得到list里面的一个goodsname字段数据。
      

  6.   

    String fullfilename = “c:\img\icon.jpg”;
    byte[] blob = new byte[1024];
    int byteread = 0;
    FileInputStream in = new FileInputStream(fullfilename); response.reset();
    response.setContentType("image/jpg");
    OutputStream toClient = response.getOutputStream(); // 读入多个字节到字节数组中,byteread为一次读入的字节数
    while ((byteread = in.read(blob)) != -1) {
    toClient.write(blob, 0, byteread);
    } in.close(); toClient.flush();
    toClient.close();
    response.flushBuffer();
      

  7.   

    现在的问题是怎样才能在action.java这里得到list里面goodsname
      

  8.   

    将二进制图片转为base64编码,直接输出到html标签中就OK了。
      

  9.   

    首页自动加载我在head之间加了这个
    <%
          if(request.getAttribute("firsttime")==null)
          {
             response.sendRedirect("loadActon.action");
          }
       %>
    但是它提示
    message There is no Action mapped for namespace / and action name loadActon.
    description The requested resource (There is no Action mapped for namespace / and action name loadActon.) is not available.
    用了这个方法是不是一定要用到namespace?
      

  10.   

    response.sendRedirect("loadActon.action");这句要改成request.getRequestDispatcher("loadActon.action").forward(request, response);
      

  11.   

    改成request.getRequestDispatcher("loadActon.action").forward(request, response);也不行啊。
      

  12.   

    已经解决了,还是用原来的这句话解决的,再次感谢大家!
    <%
          if(request.getAttribute("firsttime")==null)
          {
             response.sendRedirect("loadActon.action");
          }
       %>