问题描述
当h:commandlink与target ="_ blank"一起使用时,我的h:commandLink正在打开/预览同一页面/窗口上的pdf文档.我希望在浏览器的新标签页中打开它
My h:commandLink is opening/previewing the pdf document on same page/window when h:commandlink used with target="_blank". I want it to be opened in new tab of the browser
错误在哪里?
Preview.xhtml代码:
Preview.xhtml code:
<h:commandLink id="DocUpoadPreview" action="#{documentController.previewUploadedFile}" value="Preview" target="_blank" >
</h:commandLink>
在previewuploadedFile()操作中,需要加密/解密以及其他一些使用pdf的过程,这就是为什么必须使用而这就是为什么在这里不使用h:outputlink的原因.在执行操作过程之后,我想重定向到另一个页面(previewUploadedDoc.xhtml),该页面使用primefaces p:media标签预览文档.
In previewuploadedFile() action encription/decryption and some other process with pdf is required that is why necessary to use and that is why not using h:outputlink here. After the action process i want to redirect to another page(previewUploadedDoc.xhtml) which uses primefaces p:media tag to preview the document.
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 ="_ blank"在h:commandlink中无法在浏览器的新标签页中打开页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!