我正在尝试查看不在应用程序中但在其他驱动器中的图像。但我没有得到输出,我的动作没有被调用。请指出错误。
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
实际上我希望文件作为缩略图加载。任何帮助表示赞赏。