tabView中的选项卡更改时如何打开Jasper报告?

时间:2019-07-03 14:48:50

标签: jsf primefaces jaspersoft-studio

我想在标签栏上单击时显示我的Jasper报告

<p:tabView  id="reportTabView" styleClass="text-right">                  
    <p:ajax  event="tabChange" listener="#{bean.viewReport()}" update=""/>
    <p:tab title="" id="reportTabId" >
        <p:panel id="report_panel" rendered="" toggleable="true" 
        styleClass="reportpanel"  toggleSpeed="500" closeSpeed="500" 
        widgetVar="panel">
            <jr:source id="jasper_source" type="jndi" value="# 
            {appSettings['report.connection.jndi']}" />
            <jr:reportFrame  id="report1" rendered=""
            value="" format="pdf" source="jasper_source" style="width: 95%  
            !important; 
            height: 600px !important;">
               <f:param name="headerRelPath" value="#{bean.headerRealPath}" />
            </jr:reportFrame>
        </p:panel> 
    </p:tab>
</p:tabView>

和bean中的两个方法是一个用于查看报告,另一个用于设置标头

private void setHeaderRealPath() {
    headerRealPath = (ReportExporter.getRootPath() + 
    "/reports/TemplateHeader/");
}

public void viewReport() {
    if (selectedRow != null) {
        viewReportFlag = Boolean.TRUE;
        reportRelPath = "file.jasper";
    }
}

0 个答案:

没有答案