2 Replies Latest reply on Oct 10, 2007 2:42 AM by Tamer Gür

    dynamic component creation problem

    Tamer Gür Newbie

      hi all,
      I have problem with richfaces component creation
      when i create HtmlMenuGroup component

      Application app = FacesContext.getCurrentInstance().getApplication();
       HtmlMenuGroup group = app.createComponent(HtmlMenuGroup.COMPONENT_TYPE);

      and bind it like this

      <rich:dropDownMenu value="test">
       <rich:menuGroup value="tests" binding="#{menuSupport.group}"/>

      Iam getting classCastException for HtmlMenuGroup when I debug the code although app.createComponent(HtmlMenuGroup.COMPONENT_TYPE)
      command return HtmlMenuGroup exception occur

      also Iam using seam2.0 jboss 4.2.0

      thanks for help.

        • 1. Re: dynamic component creation problem
          Benjamin Fayle Newbie

          I don't think you're using the binding attribute properly. It should reference a property on an event scoped bean. When the restore view phase of the lifecycle occurs the set method will be called on the value expression the binding is made to. Also keep in mind that the expression must point to an event scoped bean. If your page is conversation scoped you will need to inject an event scoped bean since references to bindings cannot be maintained across requests.

          • 2. Re: dynamic component creation problem
            Tamer Gür Newbie

            thanks for reply but I can binding non-richfaces component like h:datatable no classcast exception occur but when I turn component rich:richdatatable and binding class to richfaces HtmlDatatable exception occur