0 Replies Latest reply on Aug 3, 2008 2:10 PM by Julien Martin

    How to programmatically reRender a component

    Julien Martin Expert

      Hello,
      I am having big problem reRendering an ajax component: see thread:
      http://jboss.com/index.html?module=bb&op=viewtopic&t=140231

      I am now trying to reRender it programmatically as follows with an ajaxListener:

      public class CaptchaAjaxListener implements AjaxListener {
       private static transient Logger log = Logger.getLogger("com.jeanbaptistemartin.util");
      
       @Override
       public void processAjax(AjaxEvent event) {
       log.info("processAjax");
       UIComponent comp = event.getComponent();
       UIComponent component = comp.findComponent("captchaImage");
       log.info("getClientId: "+component.getClientId(FacesContext.getCurrentInstance()));
       AjaxRenderEvent renderEvent = new AjaxRenderEvent(component);
       renderEvent.setPhaseId(event.getPhaseId());
       log.info("getPhaseId: "+ event.getPhaseId());
       component.queueEvent(renderEvent);
       }
      }
      
      




      <a4j:commandButton value="#{msg['message.envoyer']}" action="#{contactView.envoyer}" reRender="wrapper,captchaImage" >
       <a4j:ajaxListener type="com.jeanbaptistemartin.util.CaptchaAjaxListener"/>
       </a4j:commandButton>
      


      Even that fails.

      How can I make sure my captcha is reRender regardless of whether the request is an ajax request or a plain http request?

      Thanks in advance,

      Julien.