2012-12-28 25 views
4

当h:commandlink与target =“_ blank”一起使用时,我的h:commandLink正在同一页面/窗口中打开/预览PDF文档。我希望它在浏览器的新选项卡中打开target =“_ blank”in h:commandlink在浏览器的新选项卡中未打开页面

哪里可以出错?

Preview.xhtml代码:

<h:commandLink id="DocUpoadPreview" action="#{documentController.previewUploadedFile}" value="Preview" target="_blank" > 

      </h:commandLink> 

在previewuploadedFile()动作encription /解密和处理PDF其他一些工艺要求是使用必要的原因,这就是为什么不使用H:outputLink的位置。在操作过程之后,我想重定向到使用primefaces p:media标签预览文档的另一个页面(previewUploadedDoc.xhtml)。

public String previewUploadedFile() throws Exception { 


    //decryption process and adding water mark here// 
FacesContext.getCurrentInstance().getExternalContext() 
     .redirect("previewUploadedDoc.xhtml");} 
+3

你尝试 “_new”,而不是 “_blank”? –

+0

“_new”正在为我工​​作。 (使用JSF 2和Firefox) – LStrike

+0

我有同样的问题。我添加了ajax =“false”,它为我工作。 –

回答

3

试试:

<h:commandLink id="DocUpoadPreview" action="#{documentController.previewUploadedFile}" value="Preview" target="_new" /> 
相关问题