`

下载代码

    博客分类:
  • ADF
 
阅读更多

鉴于ADF中结合CommonWork的框架时,使用的下载方式不同而结果不一样,需要统一代码:

    /**
     * 附件下载
     * @param facesContext
     * @param outputStream
     * @throws SQLException
     * @throws FileNotFoundException
     * @throws IOException
     */
    public void downLoadListener(FacesContext facesContext, OutputStream outputStream) throws SQLException,
                                                                                              FileNotFoundException,
                                                                                              IOException {
        try {
            XtglFjViewImpl vo = (XtglFjViewImpl) ADFUtils.findIterator("XtglFjView2Iterator").getViewObject();
            Row row = vo.getCurrentRow();
            if (row != null) {
                String fjzj = (String) row.getAttribute("Fjzj"); //附件主键(fjzj 为附件主键)
                fjmc = (String) row.getAttribute("Fjmc");
                //AnnexOperationFile.downloadAnexx(outputStream, fjzj, AnnexOperationFile.TODATA, vo);
                //fileUploadUtils.downloadFile(facesContext, outputStream, "JYGL_SYDQR");
                AffixManage ao = new AffixManage(fjmc);
                ao.downloadAnexx(outputStream, null, null, fjzj, AffixManage.TODATA);
            }
        } catch (Exception e) {
            log.severe(e);
            e.printStackTrace();
        }
    }

 jsff页面:

 <af:button text="下载" id="kjcgXz" icon="/images/functionicons/download.png"
    disabled="#{bindings.XtglFjView2.estimatedRowCount==0}">
       <af:fileDownloadActionListener method="#{GrSybBean.downLoadListener}"/>
</af:button>

 

 

--摘自就业管理,生源地管理

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics