I'm trying to pass some values between pages using ManagedBeans , but it's not working:
@ManagedBean
@SessionScoped
public class Chute {
private Boolean chutar;
//getters e setters...
}
On the first XHTML page I have some <p:commandButton/>
:
pag1.xhtml
<p:commandButton value="Chutar" action="#{Chute.setChutar(true)}" onstart="window.open('pag2.xhtml');"/>
<p:commandButton value="Passar" action="#{Chute.setChutar(false)}" onstart="window.open('pag2.xhtml');"/>
The second takes the data sent by the first one:
pag2.xhtml
<p:panel rendered="#{Chute.chutar}">
<p:outputLabel value="Chutou!"/>
</p:panel>
<p:panel rendered="#{Chute.chutar ? false : true}">
<p:outputLabel value="Passou!"/>
</p:panel>
The problem is when any of the buttons are clicked, pag2.xhtml appears blank. How can I solve? Are there any other approaches?