1 Reply Latest reply on May 13, 2013 12:26 AM by Siva P

    <h:commandButton> not invoking action method

    SUMIT GHOSH Newbie

      I'm just making a simple application of switching tabs using <rich:tabPanel>,in that application I've <h:commandButton> and associaed  'action"  attribute with it.but the action method is not getting called.

       

      <h:commandButton value="Next" action="#{billController.saveData}" render="tabPanel"/>. the method saveData is not getting called.

      in my bean class I've defined the method like this:

       

      public void saveData(ActionEvent event){

       

           //code

      }

       

       

      I'm enclosing the entire page herewith.can anyone have any solution to this problem???????

        • 1. Re: <h:commandButton> not invoking action method
          Siva P Master

          Hi,

           

          First of all JSF does't support nested forms.

           

          In your Xhtml page i cant find your method like,may be for displaying you have give it for dummy.

           

          public void saveData(ActionEvent event){

           

               //code

          }

          For Example,

           

          <h:commandButton action="#{urBean.downloadImage}" value="Download Image" type="submit" >

          public void downloadImage()

          {

              //ur code

          }

          The action attribute accepts a method-binding expression for a backing bean action method to invoke when this component is activated by the user. An action method must be a public method with no parameters that returns a String. The returned string represents the logical outcome of the action (eg. "success", "failure", etc. ) and is used by the JavaServer Faces MVC framework to determine which view to display next.

           

          <h:commandButton actionListener="#{urBean.downloadImage}" value="Download Image" type="submit" >

          public void downloadImage(ActionEvent ae)

          {

              //ur code

          }

          The actionListener attribute accepts a method-binding expression for a backing bean action listener method that will be notified when this component is activated by the user. An action listener method must be a public method with an ActionEvent parameter and a void return type.

           

          I can find only the below code from you application,

          <a4j:commandButton  value="Remove File" actionListener="#{fileUploadController.removeFile}" reRender="data"></a4j:commandButton>

           

          So please debug it.

           

          Thanks,

          Siva