使用 Primefaces 4.0 和 JSF 2.2。
我想将访问者发送到新窗口(而不是选项卡)中的页面。登陆页面是一个名为 grade.xhtml
我尝试过:
<h:commandLink value="OK" onclick="window.open('grade.html', 'newwindow','width=300, height=300'); return false;"/>
这会导致 404 错误。显然这一切都发生在客户端,因此grade.html 不会从grade.xhtml
生成。我该怎么办?
注意:如果我输入 onclick="window.open('grade.xhtml', 'newwindow','width=300, height=300'); return false;"
然后页面确实打开了,但显示的是 jsf(xhtml 代码)而不是 html 版本。
最佳答案
试试这个:
<h:commandLink value="OK" action="grade.xhtml" target="_blank"/>
看这里的例子:When i click on any link it should Open in the same New Window in JSF, Primefaces
关于jsf - 如何使用 h :commandLink? 在新窗口而不是选项卡中打开页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22986883/