当h:commandlink与target =“_ blank”一起使用时,我的h:commandLink在同一页面/窗口上打开/预览pdf文档。我希望它在浏览器的新选项卡中打开
哪里可以是错误?
Preview.xhtml代码:
<h:commandLink id="DocUpoadPreview" action="#{documentController.previewUploadedFile}" value="Preview" target="_blank" >
</h:commandLink>
在previewuploadedFile()中,操作encription / decryption和其他一些使用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");}
试试吧:
<h:commandLink id="DocUpoadPreview" action="#{documentController.previewUploadedFile}" value="Preview" target="_new" />
target =“_ new”不是target的有效值。它将_new定义为新页面的名称。
这是有效值:qazxsw poi