I'm trying to open a new browser tab with a JSF view (in a portlet, deployed in Liferay) from within a view backed by a ViewScoped
bean. Using a normal action redirect kills the bean.
I've tried the method provided here and here, but unfortunately without success.
The button looks more or less like this:
<p:commandButton value="#{msg.label}" onclick="target='_blank'"
action="#{sessionScopedBean.action(param)}" ajax="false" />
Moving the target='_blank'
to the form attribute did not help. I've tried both returning null
and void
with no success. Changing ajax to true
broke the navigation, didn't open a new tab but also did not kill the ViewScoped
bean.
The action
method content looks like this:
public void action(String param) throws IOException {
//some business logic
FacesContext.getCurrentInstance().getExternalContext().redirect("viewName.xhtml");
}
The view does not contain tag handlers like <c:if test="...">
or <ui:include src="...">
. It did contain a <ui:repeat id="..." value="#{viewScopedBean.collection}"
var="..." varStatus="...">
tag, but removing it changed noting.
The form is enclosed in <ui:composition>
and <ui:define>
tags.
The view I redirect to has no connection with the ViewScoped bean. Any ideas? :)