2015-06-22 56 views
0

您好,我正在开发一个ADF Web应用程序。在这个我有test.jsf页面和一个showPrintablePage行为命令按钮。当用户点击按钮时,adf只是在新窗口中显示可打印的页面。但是当用户点击按钮时,它应该直接显示在浏览器的打印窗口中。为此,我从ADF代码角获得了以下代码。如何在Oracle中显示可打印页面时启动打印对话框ADF

public void beforePhaseMethod(PhaseEvent phaseEvent) { 
    if (phaseEvent.getPhaseId() == PhaseId.RENDER_RESPONSE) { 
     FacesContext fctx = FacesContext.getCurrentInstance(); 
     AdfFacesContext adfFacesContext = AdfFacesContext.getCurrentInstance(); 
     if (adfFacesContext.getOutputMode() == OutputMode.PRINTABLE) { 
      ExtendedRenderKitService erks = null; 
      erks = Service.getRenderKitService(fctx, ExtendedRenderKitService.class); 
      erks.addScript(fctx, "window.print();"); 
     } 
    } 
} 

我已经按照文件中指定的过程。下面是test.jsf页面代码。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<%@ page contentType="text/html;charset=UTF-8"%> 
<%@ taglib uri="http://xmlns.oracle.com/adf/faces/rich" prefix="af"%> 
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> 
<f:view beforePhase="#{viewScope.PieBean.beforePhaseMethod}"> 
    <af:document title="printTest" id="d1"> 
     <af:form id="f1"> 
      <af:commandButton text="commandButton 1" id="cb1"> 
       <af:showPrintablePageBehavior/> 
      </af:commandButton> 
      <af:goButton text="goButton 1" id="gb1"/> 
     </af:form> 
    </af:document> 
</f:view> 

但它显示test.jsf属性检查beforePhaseMethod是未知属性。

最后出来如下 enter image description here 请大家帮忙。 在此先感谢。

回答

0

你有没有在ADFC-配置注册豆,或者如果您使用的是任务流,然后在任务流配置。另外从截图看来,你似乎正在获得所需的输出。

相关问题