在actionListener方法中的ExternalContext.redirect之后重新呈现页面

时间:2014-04-02 14:49:04

标签: jsf ajax4jsf

我有一个a4j:commandButton,其actionListener方法调用ExternalContext.redirect。在a4j:commandButton中,我指定了一个reRender,但好像调用ExternalContext.redirect会导致reRender不会发生。无论如何我可以让reRender工作吗?

<a4j:outputPanel ajaxRendered="true" > 
        <rich:panel id="lastPrint">
          <label>Last Printed By</label>
          <h:outputText value="#{report.lastPrintPerson.name.displayName}"/>
          <label>Last Printed On</label>
          <h:outputText value="#{report.printedOnDate}" />
        </rich:panel>
    </a4j:outputPanel>

<a4j:commandButton style="buttonLeft" value="Print"  actionListener="#{reportHandler.printReport}"
        reRender="lastPrint" ajaxSingle="true">

 public void printReport()
{
        String reportUrl = "http://someurl";
        report.setLastPrintPersonId(User.instance().getPerson().getId());
        report.setPrintedOnDate(new Date());
        reportManager.updateReport(report);
        FacesContext.getCurrentInstance().getExternalContext().redirect(reportUrl);
}

0 个答案:

没有答案