Target = "_ blank" in h: commandlink does not open the page in a new browser tab

My h: commandLink opens / views a PDF document on the same page / window when h: commandlink used with target = "_ blank". I want it open in a new browser tab

where could there be a mistake?

Preview.xhtml Code:

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

In preloading preloadloadFile (), the action is activated / decrypted, as well as some other process with pdf, therefore it is necessary to use, and therefore do not use h: outputlink here. After the process, I want to redirect to another page (previewUploadedDoc.xhtml), which uses the p: media preface to preview the document.

 public String previewUploadedFile() throws Exception { //decryption process and adding water mark here// FacesContext.getCurrentInstance().getExternalContext() .redirect("previewUploadedDoc.xhtml");} 
+4
source share
1 answer

Try:

 <h:commandLink id="DocUpoadPreview" action="#{documentController.previewUploadedFile}" value="Preview" target="_new" /> 
+3
source

All Articles