0

I have a RichFaces project on JSF 2.2 and I wanted to show status updates and messages to the user while processing their request. I wanted to use a a4j:outputpanel with a simple outputext for this. I added a system.out line and it shows up on my server console when but the text on the screen is not updated.

In my process class:

private void showAdvise(final String message) {
   System.out.println(">>>>>ComUI showAdvise: " + message);
   this.beidCardStatusBean.updateStatus(message);
}

On my jsf page: - I launch the proces with:

 <a style="font-size:150%;" onclick="startEID();" 
href="savePhoto.do?userId=#{detailUserBean.id}">#{UIMessages['button.loadPhoto']}</a>

<a:outputPanel id="eidPaneContainer" ajaxRendered="true">
  <rich:popupPanel header="EID" id="eidPane" width="100" height="80">
    <h:outputText id="eidStatus" value="#{beidCardStatusBean.getStatus()}" >
    </h:outputText>
  </rich:popupPanel>
</a:outputPanel>
NMathur
  • 829
  • 1
  • 17
  • 35
  • Can you post more code? What does `startEID` do? How is the popuppanel being refreshed? – Makhiel Apr 21 '20 at 17:59
  • startEID function just opens the popuppanel: The popuppanel isn't being refreshed when i call the showadvice function in my class which is the problem – Rhand Altor Apr 22 '20 at 06:40
  • See [how to render component from bean](https://stackoverflow.com/questions/11365094/can-i-update-a-jsf-component-from-a-jsf-backing-bean-method) – fuggerjaki61 Apr 22 '20 at 10:43

1 Answers1

0

In order to update the components the page has to send a request to the server, it doesn't happen automatically when something on the server changes. The easy solution is to use a poll, e.g.

<a4j:poll id="poll" interval="2000" enabled="#{bean.pollEnabled}" render="poll, popup" />

This will rerender the popup every 2 seconds. So in your case startEID needs to set pollEnabled and rerender the poll to start it.

PopupPanel might be a bit problematic when it comes to rerendering, try setting domElementAttachment="parent" if this doesn't work.

Makhiel
  • 3,874
  • 1
  • 15
  • 21