Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to keep FacesMessage displayed

Tags:

jsf

primefaces

I display messages in my application

However, the messages are shown brifely and I would like to keep them on screen until they are closed manually.

How can i achieve this ?

EDITED:

I invoke the run method where messages are made. I invoke the component pbAjax which then updates the growl element

I use

<p:growl id="growl" />  

<p:commandButton value="Run"  actionListener="#{myBean.run}"    id="btnSubmitCreation" onclick="PF('pbAjax').start();" 

<p:progressBar widgetVar="pbAjax" ajax="true" value="#{progressBean.progress}"  styleClass="animated" >
    <p:ajax event="complete" listener="#{controleBean.onComplete}" update="growl" oncomplete="startButton2.enable()"/>                            
</p:progressBar>

Java code:

public void run() {
    ...
    ...
    List<String> messages = expResult.getMessages();
    for (String message:messages){
       FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO,message,message));  
    }
} 
like image 942
Makoto Avatar asked Jan 18 '26 05:01

Makoto


1 Answers

Just add sticky="true" in growl tag.


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!