0 Replies Latest reply on Jan 8, 2012 7:25 PM by Jiri Chaloupka

    setting bean parameter when page is loading

    Jiri Chaloupka Newbie

      Hallo,

      I have RF 3.3.3, JSF 1.2 and code:

       

      <rich:dataTable id="dataListTableLeft" value="#{myBean.listLeft}" var="item"  width="100%" >

      ...

      <ui:component binding="#{myBean.myComponent}">

        <f:attribute name="parameterId" value="#{item.parameterId}" />

      </ui:component>


      <rich:dataTable id="dataListTableTasks" value="#{myBean.listForItem}" var="sitem" rowClasses="row1, row2"

                    onRowMouseOver="this.style.backgroundColor='#B5F3FB'"

              onRowMouseOut="this.style.backgroundColor='#{a4jSkin.rowBackgroundColor}'" width="100%">

      ...

       

      It means, I have 2 dynamic lists, first list loads enabled content items and on base of content type (it tells me which function I have to call, it is ok) and parameter, I am loading next list.

      I tried to use ui:component by http://stackoverflow.com/questions/1094910/how-to-set-bean-property-value-in-jsf-page, but it is not working - by code

       

      public void setMyComponent(UIComponent c) { component = c; }

      public UIComponent getMyComponent() { return component; }

      private Object field;

      private void lookupFields() {

                          this.log("call lookupFields()");

                            field = getMyComponent().getAttributes().get("parameterId"); // returns null

                            this.log("lookupFields() field parameterId: "+field);

                            Map<String, Object> attrs = getMyComponent().getAttributes();

                            this.log("attrs size: "+attrs.size()); // have only 2 JSF system attributes

                            for(String key: attrs.keySet()){

                                      this.log("for key "+key+" have value "+attrs.get(key));

                            }

                           

                }

                public String getReadParameterId() {

                            if (field == null) {

                              lookupFields();

                            }

                            this.log("field: "+field);

                            return "" + field;

                }

       

       

       

      Simple nested one table loading is not usable, because content represented by second table is different - sometimes it is table, sometimes it is not table but dynamically generated image etc.

       

      I do not thing that nobody has similar problem, so I think I have some blind alley in my head and I need to find good way to do it..

       

      Thank you

      Jiri