【问题标题】:jsf 2.0 redirect to new tabjsf 2.0 重定向到新标签
【发布时间】:2014-03-21 14:08:31
【问题描述】:

我正在尝试重定向到新标签页,这段代码应该可以工作,但它会将我重定向到同一页面

xhtml 页面

    <h:form id="previewForm1" target="_blank">
        <p:commandButton value="Preview" action="#{executeJasper.printOnCriteria}" >
            <f:setPropertyActionListener target="#{executeJasper.format}" value=".html"/>
            <f:setPropertyActionListener target="#{executeJasper.listOnCriteria}" value="#{reports2.exportedWorkOrders}"/>
            <f:setPropertyActionListener target="#{executeJasper.order_by_form}" value="detail_no"/>
        </p:commandButton>
    </h:form>

豆子

     try {
                System.out.println("Redirecting....");
                FacesContext.getCurrentInstance().getExternalContext().redirect(sHandler.getServerURL() + "VAS/faces/Downloads/" + folderName + "\\WorkOrderDetails_" + wOrder + format);
            } catch (IOException ex) {
                System.out.println("Output File: " + outputFile + " not found");
            }

【问题讨论】:

    标签: redirect jsf-2 xhtml


    【解决方案1】:

    您可以在 bean 中通过两种方式实现重定向,您可以创建一个返回类型为 String 的方法,您可以返回该 xhtml 页面,如 并假设您要重定向到 test1.xhtml

     public String test() {
     //Do some operation
            return test1;
    
        }
    

    第一个可能是对的,但你应该检查它是否正确。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-09-25
      • 2012-04-23
      • 2011-08-14
      • 1970-01-01
      • 2012-11-30
      • 2011-06-24
      • 2011-04-26
      • 1970-01-01
      相关资源
      最近更新 更多