我正在使用primefaces p:media组件将pdf显示到我的应用程序中 . 当用户在视图中单击commandButton时;我在我的managedBean bean中进行somme任务来改变pdf内容;但我注意到尽管我的managedBean方法被调用并且不同的值发生了变化,但我的p:media组件没有更新 . 问题是什么??

<h:form  id="statistiques" prependId="false">
        <h3 class="row header smaller lighter blue">
            <span class="col-xs-6"> Statistiques </span><!-- /.col -->
        </h3>
        <div class="row statistique-form">
            <div class="form-group col-sm-2">
                <label class="control-label col-xs-12 col-sm-12" for="date-naissance">Période</label>

                <div class="col-xs-12 col-sm-12">
                    <div class="input-group">
                        <input class="form-control"   type="text" name="date-range-picker" id="id-date-range-picker-1"  jsf:value="#{statistiqueOneBean.periode}"/>
                    </div>
                </div>
            </div> 
            <div class="form-group col-sm-2">
                <label class="control-label col-xs-12 col-sm-12"></label>
                <div class="col-xs-12 col-sm-12">
                    <div class="btn-toolbar btn-opt">
                        <p:commandButton  action="#{statistiqueOneBean.create}" ajax="false" value="Visualiser" id="submit"  immediate="true"  class="btn btn-warning dropdown-toggle btn-opt-btn" >
                        </p:commandButton>
                    </div>
                </div>
            </div> 

            <div class="form-group col-sm-2">
                <label class="control-label col-xs-12 col-sm-12"></label>
                <div class="col-xs-12 col-sm-12">
                    <div class="btn-toolbar btn-opt">
                        <p:commandButton  id="downloadLinkPdf"  ajax="true" immediate="true"  value="Download to pdf" class="btn btn-warning dropdown-toggle btn-opt-btn" >
                            <p:fileDownload value ="#{statistiqueOneBean.pdf}" />  
                        </p:commandButton>
                    </div>
                </div>
            </div>

            <div class="form-group col-sm-2">
                <label class="control-label col-xs-12 col-sm-12"></label>
                <div class="col-xs-12 col-sm-12">
                    <div class="btn-toolbar btn-opt">
                        <p:commandButton  id="downloadLinkWord"  ajax="false" immediate="true"  value="Download to word" class="btn btn-warning dropdown-toggle btn-opt-btn" >
                            <p:fileDownload value ="#{statistiqueOneBean.doc}" />  
                        </p:commandButton>
                    </div>
                </div>
            </div> 
            <div class="form-group col-sm-2">
                <label class="control-label col-xs-12 col-sm-12"></label>
                <div class="col-xs-12 col-sm-12">
                    <div class="btn-toolbar btn-opt">
                        <p:commandButton  id="downloadLinkExcel"  ajax="false" immediate="true"  value="Download to excel" class="btn btn-warning dropdown-toggle btn-opt-btn" >
                            <p:fileDownload value ="#{statistiqueOneBean.xls}"/>  
                        </p:commandButton>
                    </div>
                </div>
            </div> 
        </div> 
        <hr></hr>
        <div class="row">
            <div class="panel-group">
                <div class="col-md-12 center">
                    <p:media id="apercu" value="#{statistiqueOneBean.apercu}" player="pdf" width="1024" height="500">
                    </p:media>
                </div>
            </div>
        </div>    
    </h:form>

这是我的视图代码源

@Named(value = "statistiqueOneBean")
@SessionScoped
public class StatistiqueOneBean implements Serializable {

private JasperPrint jasperPrint;
private String startDate = "2015-01-01";
private String endDate = "2015-08-25";
private String periode;
private StreamedContent doc;
private StreamedContent xls;
private StreamedContent pdf;

@Inject
StatistiqueFacade statistiqueFacade;

public StatistiqueOneBean() {
}

@PostConstruct
public void init() {
}

public JasperPrint getJasperPrint() {
    return jasperPrint;
}

public void setJasperPrint(JasperPrint jasperPrint) {
    this.jasperPrint = jasperPrint;
}

public StreamedContent getApercu() {
    String reportPath = "/Users/administrateur/NetBeansProjects/juridictionOne.jasper";
    StreamedContent apercu = null;
    try {
        HashMap parameterMap = new HashMap();
        parameterMap.put("dossier_enrol", "2");
        parameterMap.put("dossier_traite", "5");
        parameterMap.put("duree_moy", "2");
        jasperPrint = JasperFillManager.fillReport(reportPath, parameterMap, createReportDataSource(startDate, endDate));
        apercu = Reporter.PDFStreamedContent(jasperPrint);
        System.out.println(apercu.getStream());
        return apercu;
    } catch (JRException ex) {
        Logger.getLogger(StatistiqueOneBean.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(StatistiqueOneBean.class.getName()).log(Level.SEVERE, null, ex);
    }
    return apercu;
}

public String getStartDate() {
    return startDate;
}

public void setStartDate(String startDate) {
    this.startDate = startDate;
}

public String getEndDate() {
    return endDate;
}

public void setEndDate(String endDate) {
    this.endDate = endDate;
}

public String getPeriode() {
    return periode;
}

public void setPeriode(String periode) {
    this.periode = periode;
}

public void create() throws IOException, JRException {
    FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("statistiqueOneBean", null);
    System.out.println("change");
    System.out.println("change " + RequestListener.periode);
    startDate = "2015-01-01";
    endDate = "2015-01-01";

}

private JRDataSource createReportDataSource(String startDate, String endDate) {
    JRBeanCollectionDataSource datasource = new JRBeanCollectionDataSource(statistiqueFacade.statistiqueOne(startDate, endDate));
    /*JRBeanArrayDataSource datasource;
     JuridictionStatistiqueOne[] reportRows = initializeBeanArray();

     datasource = new JRBeanArrayDataSource(reportRows);*/
    return datasource;
}

public void doDocx() throws IOException {
    String reportPath = "/Users/administrateur/NetBeansProjects/juridictionOne.jasper";
    try {
        jasperPrint = JasperFillManager.fillReport(reportPath, new HashMap(), createReportDataSource("2015-01-01", "2015-08-25"));
        doc = Reporter.DocStreamedContent(jasperPrint);
    } catch (JRException ex) {
        Logger.getLogger(StatistiqueOneBean.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(StatistiqueOneBean.class.getName()).log(Level.SEVERE, null, ex);
    }
}

private JuridictionStatistiqueOne[] initializeBeanArray() {
    JuridictionStatistiqueOne[] reportRows = new JuridictionStatistiqueOne[4];
    reportRows[0] = new JuridictionStatistiqueOne("N263Y", "1", "1", "1", "1", "1");
    reportRows[1] = new JuridictionStatistiqueOne("N263Y", "1", "1", "1", "1", "1");
    reportRows[2] = new JuridictionStatistiqueOne("N263Y", "1", "1", "1", "1", "1");
    reportRows[3] = new JuridictionStatistiqueOne("N263Y", "1", "1", "1", "1", "1");
    return reportRows;
}

public void getPDF(String startDate, String endDate) throws IOException {
    StreamedContent apercu = null;
    String reportPath = "/Users/administrateur/NetBeansProjects/juridictionOne.jasper";
    try {
        HashMap parameterMap = new HashMap();
        parameterMap.put("dossier_enrol", "2");
        parameterMap.put("dossier_traite", "2");
        parameterMap.put("duree_moy", "2");
        jasperPrint = JasperFillManager.fillReport(reportPath, parameterMap, createReportDataSource(startDate, endDate));
        apercu = Reporter.PDFStreamedContent(jasperPrint);
    } catch (JRException ex) {
        Logger.getLogger(StatistiqueOneBean.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(StatistiqueOneBean.class.getName()).log(Level.SEVERE, null, ex);
    }

}

public void doPDF(String startDate, String endDate) throws IOException {
    getPDF(startDate, endDate);

}

public StreamedContent getDoc() {
    String reportPath = "/Users/administrateur/NetBeansProjects/juridictionOne.jasper";
    try {
        jasperPrint = JasperFillManager.fillReport(reportPath, new HashMap(), createReportDataSource("2015-01-01", "2015-08-25"));
        doc = Reporter.DocStreamedContent(jasperPrint);
    } catch (JRException ex) {
        Logger.getLogger(StatistiqueOneBean.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(StatistiqueOneBean.class.getName()).log(Level.SEVERE, null, ex);
    }
    return doc;
}

public StreamedContent getPdf() {
    String reportPath = "/Users/administrateur/NetBeansProjects/juridictionOne.jasper";
    try {
        jasperPrint = JasperFillManager.fillReport(reportPath, new HashMap(), createReportDataSource("2015-01-01", "2015-08-25"));
        pdf = Reporter.PDFStreamedContent(jasperPrint);
    } catch (JRException ex) {
        Logger.getLogger(StatistiqueOneBean.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(StatistiqueOneBean.class.getName()).log(Level.SEVERE, null, ex);
    }
    return pdf;
}

public StreamedContent getXls() {
    String reportPath = "/Users/administrateur/NetBeansProjects/juridictionOne.jasper";
    try {
        jasperPrint = JasperFillManager.fillReport(reportPath, new HashMap(), createReportDataSource("2015-01-01", "2015-08-25"));
        xls = Reporter.XlsStreamedContent(jasperPrint);
    } catch (JRException ex) {
        Logger.getLogger(StatistiqueOneBean.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(StatistiqueOneBean.class.getName()).log(Level.SEVERE, null, ex);
    }
    return xls;
}

}

这是我的托管bean代码源