jsf target ="_ blank"无法与primefaces命令按钮一起使用 [英] jsf target="_blank" not working with primefaces commandbutton
本文介绍了jsf target ="_ blank"无法与primefaces命令按钮一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试打开新标签以接受从Bean生成的pdf文件.
Trying to open a new tab to accept a generated pdf file from the bean.
使用h:commandbutton,没有使用p.commandbutton打开选项卡.
Works with h:commandbutton, no tab opened with p.commandbutton.
试图将onclick和oncomplete ="window.open('_ blank')放在p:commandbutton上,它会打开一个新标签,但没有获取pdf,并显示找不到错误404".
Tried to put onclick and oncomplete="window.open('_blank') on the p:commandbutton, it opens a new tab but it doesn't get the pdf and gets "Error 404 Not Found".
使用primefaces-3.1
Using 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>
推荐答案
尝试设置
ajax="false"
在您的p:commandButton
上,它的行为应类似于h:commandButton
On your p:commandButton
, this way it should behave like h:commandButton
这篇关于jsf target ="_ blank"无法与primefaces命令按钮一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文