2 Replies Latest reply on Jun 8, 2007 8:14 AM by Julien Martin

    show/hide an outputpanel using a4j

    Julien Martin Expert

      Hello,

      I am trying to show/hide an outputpanel when a user clicks a button all this using ajax.

      I was not able to find any "render" attribute instead of the reRender one. Can anyone please help?

      Julien.

      <f:view>
      
       <a4j:outputPanel ajaxRendered="true">
       <h:messages />
       </a4j:outputPanel>
      
       <h:form>
       <a4j:commandButton action="#{TheManagedBean.theAction}" reRender="the-hidden" immediate="true" value="Click"/>
       </h:form>
      
       <h:outputText value="#{TheManagedBean.componentRendered}"/>
      
       <a4j:outputPanel id="the-hidden" rendered="#{TheManagedBean.componentRendered}">
       <h:outputText value="hello world"></h:outputText>
       </a4j:outputPanel>
      
       </f:view>
      


      package pack;
      
      /**
       *
       * @author jumartin
       */
      public class TheManagedBean {
      
       private boolean componentRendered;
      
       public String theAction(){
       componentRendered = true;
       System.out.println("theAction");
       return "ok";
       }
      
       public boolean isComponentRendered() {
       return componentRendered;
       }
      
       public void setComponentRendered(boolean componentRendered) {
       this.componentRendered = componentRendered;
       }
      }