Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Primefaces块UI不´;jasperreports';生成报告。_Primefaces_Jasper Reports_Blockui - Fatal编程技术网

Primefaces块UI不´;jasperreports';生成报告。

Primefaces块UI不´;jasperreports';生成报告。,primefaces,jasper-reports,blockui,Primefaces,Jasper Reports,Blockui,来自南美洲的问候。我正在生成一个报告(使用jasper reports),因此在这个过程中,我希望阻止显示适当消息的页面。报告工作得非常完美,使用以下代码行触发操作: <p:commandButton id="pago" actionListener="#{transaccionBncController.reporteGeneral}" value="Reporte General " ajax="false"/> 注意:必须使用ajax=“false”属性,否则一切都会变

来自南美洲的问候。我正在生成一个报告(使用jasper reports),因此在这个过程中,我希望阻止显示适当消息的页面。报告工作得非常完美,使用以下代码行触发操作:

<p:commandButton id="pago" actionListener="#{transaccionBncController.reporteGeneral}" value="Reporte General " ajax="false"/> 

注意:必须使用ajax=“false”属性,否则一切都会变糟,无法生成报告

现在,当我尝试添加Primefaces blockUI组件以阻止页面并显示适当的消息(在生成报告时),我使用以下代码:

<p:blockUI block="panelGrid" trigger="pago">
 Generando Reporte...<br />  
 <h:graphicImage library="images" name="ajaxloading.gif"/> 
</p:blockUI>

通用报告…
blockUI组件运行良好,但报告不再运行。 我已经尝试了所有方法,关于ajax=“false”属性和阻塞页面的问题总是一样的

以下是我工作的整个资源:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org    /TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:p="http://primefaces.org/ui">

<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/template.xhtml">

    <ui:define name="content" >
        <fieldset id="fieldsetgenerico" >
            <legend> Reporte General </legend>
            <h:form id="formreporte">
                <p:growl autoUpdate="true" life="3000"  id="growl" />  
                <h:panelGrid columns="3" id="panelGrid" >

                    <h:outputLabel value="Fecha inicial: " for="fechaInicial" /> 
                    <p:calendar id="fechaInicial" value="#   {transaccionBncController.fechaInicial}" pattern="dd/MM/yyyy"  locale="es" required="true" requiredMessage="Fecha Inicial Requerida" navigator="true" effect="fadeIn" effectDuration="100"/>

                    <h:outputLabel value="" /> 

                    <h:outputLabel value="Fecha Final: " for="fechaFinal"/>
                    <p:calendar id="fechaFinal" value="# {transaccionBncController.fechaFinal}" pattern="dd/MM/yyyy" locale="es" required="true" requiredMessage="Fecha Final Requerida" navigator="true" effect="fadeIn" effectDuration="300"/>

                    <p:tooltip for="fechaFinal" value="Campo Requerido. No puede ser anterior a la Fecha Inicial" showEffect="clip" hideEffect="clip" />

                    <h:outputLabel value="Estado: " for="estado"  />     
                    <h:selectOneMenu id="estado" value="#{transaccionBncController.estTra}"  >                                       
                        <f:selectItems value="#{estadoTransaccionBncController.itemsAvailableSelectOne}"  />                                    
                    </h:selectOneMenu>
                    <h:outputLabel value="" />

                    <h:outputLabel value="Tipo Transaccion: " for="tipoTransaccion"/>
                    <h:selectOneMenu id="tipoTransaccion" value="#{transaccionBncController.tipTra}"  
                                     valueChangeListener="#{transaccionBncController.defineTipoTransaccion}"  >
                        <f:selectItems value="#{tipoTransaccionBncController.itemsAvailableSelectOne}"/>
                        <f:ajax  execute="@all" render="panelGrid1" immediate="true"></f:ajax>     
                    </h:selectOneMenu>
                    <h:outputLabel value="" />

                    <h:outputLabel value="Entidad Financiera: " for="entidadFinanciera"  />                               
                    <h:selectOneMenu id="entidadFinanciera" value="#{transaccionBncController.cliente}" 
                                     valueChangeListener="#{transaccionBncController.actualizaAgencias}" >  
                        <f:selectItems value="#{clienteBncController.itemsAvailableSelectOne}"/>  
                        <f:ajax  execute="@form" render="panelGrid" ></f:ajax> 
                    </h:selectOneMenu>
                    <h:outputLabel value="" /> 

                    <h:outputLabel value="Agencia: " for="agencia"  />
                    <h:selectOneMenu id="agencia" value="#{transaccionBncController.ag}"  >
                        <f:selectItems value="#{transaccionBncController.itemsAvailableSelectOneAgencia}"/>                 
                    </h:selectOneMenu>
                    <h:outputLabel value="" /> 

                    <h:outputLabel value="Código Financiero: " for="codFinanciero"  />
                    <h:selectOneMenu id="codFinanciero" value="#{transaccionBncController.codigoFinanciero}"   >
                        <f:selectItems value="#{productoBncController.itemsAvailableSelectOneC}"/>
                    </h:selectOneMenu>
                    <h:outputLabel value="" />

                </h:panelGrid>           
                <br/>               
                <h:panelGrid columns="2" id="panelGrid1">   
                    <p:commandButton id="pago" icon="ui-icon-check"  actionListener="#{transaccionBncController.reporteGeneral}" value="Reporte General " rendered="#{transaccionBncController.tipTransaccion != 'ANULACION' }" update="growl" style="margin:0" /> 
                    <p:blockUI block="panelGrid" trigger="pago"  >
                        Generando Reporte<br />  
                        <h:graphicImage library="images" name="ajaxloading.gif"/> 
                    </p:blockUI>    
                </h:panelGrid>      
            </h:form>
        </fieldset>
    </ui:define>
</ui:composition>

</html>

总报告

通用报告
我认为这个问题的根本原因是ajax交互,因为生成报告(不使用blockui代码)的工作非常出色。这是我获取报告的源代码:

public void reporteGeneral(ActionEvent actionEvent) throws JRException, IOException, SQLException {


        DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
        Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@170.25.18.38:1521:xxx", "xxx", "xxx");

        Map<String, Object> parametros = new HashMap<String, Object>();
        parametros.put("fechaInicial", fInicial);
        parametros.put("fechaFinal", fFinal);
        parametros.put("query", query);


        String reportPath = FacesContext.getCurrentInstance().getExternalContext().getRealPath("/reportes/report4.jasper");
        jasperPrint = JasperFillManager.fillReport(reportPath, parametros, conn);


        //jasperPrint=JasperFillManager.fillReport(reportPath, new HashMap(),conn); 


        HttpServletResponse httpServletResponse = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse();

        java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("dd-MM-yyyy");
        String fi = sdf.format(fInicial);
        String ff = sdf.format(fFinal);

        String fecha = fi.toString() + "_" + ff.toString();

        httpServletResponse.addHeader("Content-disposition", "attachment; filename=reporte_" + fecha + ".pdf");
        ServletOutputStream servletOutputStream = httpServletResponse.getOutputStream();

        JasperExportManager.exportReportToPdfStream(jasperPrint, servletOutputStream);

        FacesContext.getCurrentInstance().responseComplete();
}
public void reporteGeneral(ActionEvent-ActionEvent)抛出JRException、IOException、SQLException{
registerDriver(新的oracle.jdbc.driver.OracleDriver());
Connection conn=DriverManager.getConnection(“jdbc:oracle:thin:@170.25.18.38:1521:xxx”、“xxx”、“xxx”);
Map parametros=newhashmap();
参数put(“fechaInicial”,财务);
参数put(“粪便”,非粪便);
参数put(“查询”,查询);
字符串reportPath=FacesContext.getCurrentInstance().getExternalContext().getRealPath(“/reportes/report4.jasper”);
jasperPrint=JasperFillManager.fillReport(reportPath,parametros,conn);
//jasperPrint=JasperFillManager.fillReport(reportPath,newhashmap(),conn);
HttpServletResponse HttpServletResponse=(HttpServletResponse)FacesContext.getCurrentInstance().getExternalContext().getResponse();
java.text.simpleDataFormat sdf=新的java.text.simpleDataFormat(“dd-MM-yyyy”);
字符串fi=sdf.format(财务);
字符串ff=sdf.format(fFinal);
字符串fecha=fi.toString()+“”+ff.toString();
httpServletResponse.addHeader(“内容处置”,“附件;文件名=reporte_u“+fecha+”.pdf”);
ServletOutputStream ServletOutputStream=httpServletResponse.getOutputStream();
导出报告topdfstream(jasperPrint,servletOutputStream);
FacesContext.getCurrentInstance().responseComplete();
}
非常感谢你们。请原谅,如果这个问题是如此新手,但我认为这是一个很好的学习机会,因为我没有在互联网上找到关于这个主题的东西。 再次感谢你的帮助。 圣地亚哥