0

我正在尝试查看不在应用程序中但在其他驱动器中的图像。但我没有得到输出,我的动作没有被调用。请指出错误。

jsp

<img src="<s:url var="profilePic" action="download">
                    <s:param name="fid" value="test"/>
                  </s:url>" alt="logo" />

行动

       public class DownloadAction extends ActionSupport implements ServletRequestAware{
        private HttpServletRequest req;

     @Action(value="download", results = { @Result(location="/index.jsp", type="stream", 
             params={"contentType","application/octet-stream","inputName","fileInputStream","bufferSize","1024"}
             ), @Result(name="input", location="/index.jsp")
        })
    public String download() throws Exception {
            //File theFile = new File("c:\\shareapp\\admin",getReq().getParameter("fid"));
         try{
             System.out.println("inside");
                FileInputStream inputStream=FileUtils.openInputStream(new File("c:\\shareapp\\admin",getReq().getParameter("fid")));
         }catch(Exception ce)
         {
             System.out.println(ce);
         }
            return SUCCESS;
        }
//getters & setters

实际上我希望文件作为缩略图加载。任何帮助表示赞赏。

4

1 回答 1

2

如果您想使用<s:url>这样的标签,请删除var属性。如果<s:param> value属性是字符串,则用于'表明它是字符串。

<img src="<s:url action="download">
            <s:param name="fid" value="'test'"/>
          </s:url>" alt="logo" />
于 2013-04-25T07:17:47.167 回答