尝试打开一个新的选项卡以接收来自bean生成的pdf文件。
使用h:commandbutton可以正常工作,但是使用p.commandbutton无法打开选项卡。
尝试在p:commandbutton上使用onclick和oncomplete="window.open('_blank')",它会打开一个新的选项卡,但无法获取pdf文件并显示 "Error 404 Not Found"。
使用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>