title: JAVA : ZK framework how to set two bean to listbox?
body: <p>I am trying to make editable listbox that gives user ability to update listitem or cancel it.But I can't get selected item for  save it on another bean and then if user clicks cancel , show original record. This returns me null.</p>
  
  <pre class="lang-java prettyprint-override"><code>Listitem listitem =  self.getParent().getParent();
  Listbox listbox = listitem.getListbox();
  alert(listbox.getSelectedItem().getValue());
  </code></pre>
  
  <p>Also I am using zscript on .zul file for making this operation. here my listbox and update function </p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;listbox id="listModel" rows="10" mold="paging" pageSize="10"
      selectedItem="@{mainCtrl.selected}" fixedLayout="true"
      model="@{mainCtrl.model}"&gt;
      &lt;listhead&gt;
          &lt;listheader
              label="${c:l('SYSADM.ManageImportedSubscribers.table.MSISDN')}"
              sort="auto" /&gt;
          &lt;listheader
              label="${c:l('SYSADM.ManageImportedSubscribers.table.Date')}"
              sort="auto" /&gt;
          &lt;listheader
              label="${c:l('SYSADM.ManageImportedSubscribers.table.CO_ID')}"
              sort="auto" /&gt;
          &lt;listheader
              label="${c:l('SYSADM.ManageImportedSubscribers.table.Customer_ID')}"
              sort="auto" /&gt;
          &lt;listheader label="Update ?" sort="auto" /&gt;
      &lt;/listhead&gt;
  
      &lt;listitem self="@{each=MANAGE_IMPORTED_SET_DATA}"&gt;
          &lt;listcell&gt;
              &lt;label value="@{MANAGE_IMPORTED_SET_DATA.MSISDN}"&gt;&lt;/label&gt;
              &lt;textbox value="@{MANAGE_IMPORTED_SET_DATA.MSISDN}"
                  visible="false" /&gt;
          &lt;/listcell&gt;
          &lt;listcell&gt;
              &lt;label value="@{MANAGE_IMPORTED_SET_DATA.IMPORT_ID}"&gt;&lt;/label&gt;
              &lt;textbox value="@{MANAGE_IMPORTED_SET_DATA.IMPORT_ID}"
                  visible="false" /&gt;
          &lt;/listcell&gt;
          &lt;listcell&gt;
              &lt;label value="@{MANAGE_IMPORTED_SET_DATA.CO_ID}"&gt;&lt;/label&gt;
              &lt;textbox value="@{MANAGE_IMPORTED_SET_DATA.CO_ID}"
                  visible="false" /&gt;
          &lt;/listcell&gt;
          &lt;listcell&gt;
              &lt;label value="@{MANAGE_IMPORTED_SET_DATA.CUSTOMER_ID}"&gt;&lt;/label&gt;
              &lt;textbox value="@{MANAGE_IMPORTED_SET_DATA.CUSTOMER_ID}"
                  visible="false" /&gt;
          &lt;/listcell&gt;
          &lt;listcell&gt;
              &lt;button label="Update"&gt;
                  &lt;attribute name="onClick"&gt;
      Button update;
      Button delete;
      Button save;
      Button cancel;
  
      update = self;
      delete = self.getNextSibling();
  
      update.setVisible(false);
      delete.setVisible(false);
  
      Listitem listitem = self.getParent().getParent();
      int i = 0 ;                               
      while(i != 4){
          Listcell listcell = (Listcell)listitem.getChildren().get(i);
          ((Label)listcell.getChildren().get(0)).setVisible(false);
          ((Textbox)listcell.getChildren().get(1)).setVisible(true);
          i++;
      }
  
      self.getParent().appendChild(save=new Button("Save"));
      save.addEventListener("onClick",new EventListener() {
          public void onEvent(Event arg0) {
              alert("SAVE CLICKCED");
              }
      });                                                        
  
      self.getParent().appendChild(cancel = new Button("Cancel"));
      cancel.addEventListener("onClick",new EventListener() {
      public void onEvent(Event arg0) {
          Listitem listitem1 =  self.getParent().getParent();
          int i = 0 ;
          while(i != 4) {
              Listcell listcell = (Listcell)listitem1.getChildren().get(i);
              ((Label)listcell.getChildren().get(0)).setVisible(true);
              ((Textbox)listcell.getChildren().get(1)).setVisible(false);
              i++;
          }
  
          Listcell listcell = (Listcell)listitem1.getChildren().get(4);
          ((Button)listcell.getChildren().get(0)).setVisible(true);
          ((Button)listcell.getChildren().get(1)).setVisible(true);
          ((Button)listcell.getChildren().get(2)).detach();
          ((Button)listcell.getChildren().get(2)).detach();
          }
      });
                  &lt;/attribute&gt;
              &lt;/button&gt;
              &lt;button label="Delete" onClick="onDelete()"&gt;&lt;/button&gt;
          &lt;/listcell&gt;
          &lt;listcell&gt;&lt;/listcell&gt;
      &lt;/listitem&gt;
  &lt;/listbox&gt;
  </code></pre>