jsf target ="_ blank"无法使用primefaces命令按钮

mcc*_*ike 4 primefaces jsf-2

尝试打开一个新选项卡以接受来自bean的生成的pdf文件.

使用h:commandbutton,没有使用p.commandbutton打开选项卡.

试图在p:commandbutton上放置onclick和oncomplete ="window.open('_ blank'),它会打开一个新选项卡,但它不会获得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>
Run Code Online (Sandbox Code Playgroud)

Dan*_*iel 6

尝试设置

ajax="false"
Run Code Online (Sandbox Code Playgroud)

在你的p:commandButton方式,它应该表现得像h:commandButton