2 Replies Latest reply on Feb 8, 2010 7:13 AM by Ahmet temiz

    a4j:commandButton doesn't render

    Ahmet temiz Novice



      I am trying to change info button color in AJAX way. As when I press this button it is supposed to change between red an blue.

      if it is blue it is supposed to red and vice versa.


      But it never renders and no change occurs.


      I will appreciate if you tell why


      here is the jsp tag and related bean:


      <a4j:commandButton id="infobutton" value="info"
            action="#{haritaBean1.finfo}" reRender="info_in,infobutton"
            image="./images/Info24.png" >                              




      public String finfo() {


              FacesContext context = FacesContext.getCurrentInstance();
              HtmlAjaxCommandButton info_button = (HtmlAjaxCommandButton) context


              if (info_button.getImage().contains("./images/Info24.png")) {


              } else if (info_button.getImage().contains("./images/Info-red24.png")) {


              return null;






        • 1. Re: a4j:commandButton doesn't render
          Ilya Shaikovsky Master
          check if the method actually called and if image properly changed in debug.
          • 2. Re: a4j:commandButton doesn't render
            Ahmet temiz Novice

            thank you


            java bean is called.

            to save the space in my previous message. I had cleared some control statements like:


                    System.out.println(" info_button.getId()     "+info_button.getId());
                    System.out.println(" info_button.getImage()  "+info_button.getImage());


            I checked program enters the every part of the bean.


            they look ok.


            I was wondering if I understood correctly the logic of Ajax:

            - when I pressed this button its color should change and whole page is not reloaded.

            - no submit is necessary


            only related part is updated (in my case --a4j:commandButton id="infobutton"--)


            when I reload page, it looks it has worked and necessary change taken place.


            there might be any expression that blocks ajax functionality ?