当 h:commandLink 与 target="_blank" 一起使用时,我的 h:commandLink 正在同一页面/窗口上打开/预览 pdf 文档。我希望它在浏览器的新选项卡中打开
错误可能出在哪里?
Preview.xhtml代码:
<h:commandLink id="DocUpoadPreview" action="#{documentController.previewUploadedFile}" value="Preview" target="_blank" >
</h:commandLink>
在 PreviewUploadedFile() 操作中,需要加密/解密和 pdf 的其他一些过程,这就是为什么需要使用,这就是为什么这里不使用 h:outputlink 的原因。在操作过程之后,我想重定向到另一个页面(previewUploadedDoc.xhtml),该页面使用 primefaces p:media 标签来预览文档。
public String previewUploadedFile() throws Exception {
//decryption process and adding water mark here//
FacesContext.getCurrentInstance().getExternalContext()
.redirect("previewUploadedDoc.xhtml");}
Try it:
<h:commandLink id="DocUpoadPreview" action="#{documentController.previewUploadedFile}" value="Preview" target="_new" />
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)