Open page in new browser tab from bean

jsf, primefaces

Solution

The best solution that I found was:

PrimeFaces.current().executeScript("window.open('resource.jsp', '_newtab')");

Or when you're not on PrimeFaces 6.2 or newer yet:

RequestContext.getCurrentInstance().execute("window.open('resource.jsp', '_newtab')");

Problem

Is it possible to open a resource into a new browser Tab (like target="_newtab" for command buttons) from server side jsf code? The following Code opens the resource in the same tab: ``` FacesContext.getCurrentInstance().getExternalContext().redirect("resource.jsp"); ``` I'm using primefaces. I think there is a possibility with javascript and icefaces.

Original source

Related problems