2012-10-30 51 views
4

尝试打开一个新选项卡以接受来自该bean的生成的pdf文件。jsf target =“_ blank”不能使用primefaces命令按钮

适用于h:commandbutton,没有使用p.commandbutton打开的选项卡。

试图把的onclick和的onComplete =“window.open(‘_空白’)在p:命令按钮,它会打开一个新的标签,但它并没有得到PDF格式,并得到‘错误404未找到’

使用primefaces-3.1

感谢

<?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:h="http://java.sun.com/jsf/html" 
     xmlns:f="http://java.sun.com/jsf/core" 
     xmlns:p="http://primefaces.org/ui"> 


    <h:head> 
     <h:outputStylesheet library="base" name='jquery-ui-1.8.16.custom.css' /> 
    </h:head> 
    <h:form target="_blank"> 
     <p:commandButton value="Run" action="#{bean.createReport}" /> 
    </h:form> 

    </html> 

回答

6

尝试设置

ajax="false" 

在您p:commandButton,这种方式它应该像h:commandButton

+0

我曾尝试过,但试过它,它的工作原理! – mccmike