1 Reply Latest reply on Mar 24, 2009 10:34 AM by chrisad

    Problem with HtmlAjaxCommandButton and method expression

      Hello everyone!
      I have a problem that my button made in java wont fire the action Ive specified.

      I have the following code:

      HtmlCommandButton replyCommentButton = new HtmlCommandButton();
      replyCommentButton.setId("replyCommentButton" + commentCounter);
       replyCommentButton.setValue("Create reply");
      String action = "#{HandlerBean.action_replyToComment}";
      ExpressionFactory factory = context.getApplication().getExpressionFactory();
      Class [] argtypes=new Class[1];
      argtypes[0]=ActionEvent.class;
      
      MethodExpression replyActionExpression = factory.createMethodExpression(context.getELContext(), action, null, argtypes);
      
      replyCommentButton.setActionExpression(replyActionExpression);
      


      This doesnt work. It renders the button and it looks good, but nothing happens when I click it. Right below that button I have another button which Ive defined in my JSF file. It looks like this, and works perfectly:
      <a4j:commandButton action="{Handler.action_replyToComment}" value="testButtonThatWorks" />


      Anyone have any ideas? Thank you very much