0 Replies Latest reply on Feb 22, 2008 9:33 AM by Martin Verzilli

    Programmatically create a jsFunction and pass parameters to

    Martin Verzilli Newbie

      Hi! I'm trying to programmatically create a jsFunction and pass parameters to a bean. The call to the corresponding action in the bean works alright, but I couldn't find a way to get the params assigned to properties in it.

      I'll show you a simplified example of the code I'm using:

      First, I have a custom component, let's call it MyComponent. In the setProperties method of the corresponding MyComponentTag class I have the following code:

      HtmlAjaxFunction myFunction = new HtmlAjaxFunction();
      myFunction.setAction(application.createMethodBinding("#{myBean.myFunctionAction}", null));
      HtmlActionParameter htmlActionParam = new HtmlActionParameter();

      The "application" variable holds the current Application instance (taken from the current Faces context) .

      Then I have a bean class MyBean with a private member myParam (and its corresponding getters and setters) and a method for the action myFunctionAction.

      I put a breakpoint in the body of the myFunctionAction method, then I call myFunction from the Firebug js console, and the myFunctionAction method is efectively being called. The problem, as I previously said, is the myParam property is never written to.

      Can anybody see anything wrong with my code? Perhaps it's completely wrong...

      Thanks in advanced for your help!