1 Reply Latest reply on Mar 15, 2013 7:31 AM by Lukáš Macko

    MethodExpression attribute evaluated to null

    Lukáš Macko Newbie


      I'm writing component for chart plotting using CDK. The component has an attribute dataclickListner which is methodexpression pointing to method. It should be invoked in broadcast method when DataClickEvent occurs. However this attribute is evaluated to null. 


      i followed this tutorial - part of events.


      Snippet from AbstractChart.java


      @JsfComponent( type = "sk.lukasmacko.richfaces.chart.component.Chart",  family = "sk.lukasmacko.Chart",  renderer =  @JsfRenderer(type = "sk.lukasmacko.chartRenderer"),

        tag =  @Tag(name = "chart"),   fires = {@Event(value = DataClickEvent.class, listener = DataClickListener.class)}


      abstract public class AbstractChart extends javax.faces.component.UIComponentBase {





          @Attribute(signature =

          @Signature(parameters = DataClickEvent.class))

          public abstract MethodExpression getDataClickListener();



          public void broadcast(FacesEvent event) throws AbortProcessingException {

              if (event instanceof DataClickEvent) {

                  FacesContext facesContext = getFacesContext();

                  MethodExpression expression = getDataClickListener();

                  if (expression != null) {

                      expression.invoke(facesContext.getELContext(), new Object[]{event});












      Usage of component

      {code:xml}<lm:chart dataClickListener="#{myBean.dataclick}" ...>...{code:xml}




      dataclick is method in managedbean


      public void dataclick(DataClickEvent event){

              setMsg("An event occured! ");



      component sources   and example of usage


      any help appreciated thanks!