-3
I have a modal that is loaded after login (automatic), but at each refresh the modal opens, I need it to open only once after logging in.
<rich:modalPanel id="modal" autosized="true" width="500" height="200" showWhenRendered="#{true}">
<f:facet name="controls">
<h:graphicImage value="/img/fechando.png" onclick="Richfaces.hideModalPanel('modalMensagem')"
id="botaoFechar" />
</f:facet>
<f:facet name="header">
<h:panelGroup>
<h:outputText value="Olá" />
</h:panelGroup>
</f:facet>
<h:outputText value="#{bean.mensagem}" escape="true" style="font-size:15px;"/>
</rich:modalPanel>
tela2.xhtml
<ui:define name="conteudo">
<h:form id="main">
<rich:messages styleClass="msgerro" globalOnly="true" />
<center style="font-size: 10pt;">
Olá
<br />
</center>
</h:form>
<ui:include src="/modal/modalMensagem.xhtml"/>
</ui:define>
BEAN
public String getMensagem() {
return MENSAGEM;
}
Do I need a method to actually enter false to open only once? Since showWhenRendered by default is true.
If you want to open only once after the first login, you will have to write a flag saying you have already opened once. If you want to open the first time per session, you can set this flag as a session attribute and use it as a condition not to open the popup.
– nullptr
Is there an example for me to check how it does? Some tutorial...
– Frederico Queiroz
If you do not want to write to the database, you can write to the user’s location.
– Pablo Harger
Any example? Because I don’t know if creating a false setando method would solve...
– Frederico Queiroz