ssh在xxxAction传递值时出现空指针的问题

public class FileDownloadAction extends ActionSupport
{
    public InputStream getDownloadFile()
    {
        return ServletActionContext.getServletContext().getResourceAsStream("upload/通讯录2012年9月4日.xls");
    }
    
    @Override
    public String execute() throws Exception
    {
        return SUCCESS;
    }
}

原因可能是因为在bean.xml中没有注入配置信息

<action name="fileDownload" class="com.xiaoluo.struts2.FileDownloadAction">
  <result name="success" type="stream">
    <param name="contentDisposition">attachment;filename="通讯录2012年9月4日.xls"</param>
    <param name="inputName">downloadFile</param>
  </result>
</action>

  

posted @ 2017-08-07 00:55  _江江江江  阅读(531)  评论(0编辑  收藏  举报