5 Replies Latest reply on Jul 17, 2009 3:18 AM by Daniel Margreth

    rich:listShuttle problem

    Shivaji Byrapaneni Newbie

      Hi There,

      I had my jsp included with rich:listShuttle when i tried to do any action after the listShuttle had been populated im getting thsi error

      Component nominationSystemHome:listShuttle has invalid value expression com.vo.ApproveVO@fea10aee"
      
      


      im using ths in my jsp
      <rich:listShuttle sourceValue="#{approveCoursesBean.nominatedList}"
       targetValue="#{approveCoursesBean.approvedList}" var="items"
       sourceCaptionLabel="Nominated people"
       targetCaptionLabel="People to approve" id="listShuttle"
       converter="approveCoursesConverter">
       <rich:column width="18">
       <h:graphicImage value="#{items.iconURI}" width="25px" height="25px"></h:graphicImage>
       </rich:column>
       <rich:column>
       <h:outputText value="#{items.label}"></h:outputText>
       </rich:column>
       </rich:listShuttle>
      


      and my mbean had this

      private ArrayList<ApproveVO> approvedList = new ArrayList<ApproveVO>();
       private ArrayList<ApproveVO> nominatedList = new ArrayList<ApproveVO>();
      


      with setters and getters

      and my VO is this

      package com.vo;
      
      import java.io.Serializable;
      
      public class ApproveVO implements Serializable {
      
       private String iconURI;
       private String label;
      
       public ApproveVO(String iconURI, String label) {
       this.iconURI = iconURI;
       this.label = label;
       }
      
       public String getIconURI() {
       return iconURI;
       }
      
       public void setIconURI(String iconURI) {
       this.iconURI = iconURI;
       }
      
       public String getLabel() {
       return label;
       }
      
       public void setLabel(String label) {
       this.label = label;
       }
      
       @Override
       public boolean equals(Object obj) {
       if (this == obj)
       return true;
       if ((obj == null) || (obj.getClass() != this.getClass()))
       return false;
       ApproveVO approveVO = (ApproveVO) obj;
       if (approveVO.iconURI.equals(this.iconURI)
       && approveVO.label.equals(this.label))
       return true;
      
       return false;
       }
      
       @Override
       public int hashCode() {
       int hash = 7;
       hash = 31 * hash;
       hash = 31 * hash + (null == this.label ? 0 : this.label.hashCode());
       return hash;
      
       }
      }
      
      


      i had implemneted my equals method perfectly along with hashcode method..



      Please help me..

      many thansk in advance..

        • 1. Re: rich:listShuttle problem
          Ilya Shaikovsky Master

           

          i had implemneted my equals method perfectly along with hashcode method..


          So just debug the converter methods during submit. Such message always caused by some problems in converter or equals/hashCode.

          • 2. Re: rich:listShuttle problem
            Shivaji Byrapaneni Newbie

            My converter is also fine

            here is my code

            @Override
             public Object getAsObject(FacesContext context, UIComponent component,
             String value) {
             NominationLogger.debug("getAsObject executed...");
             NominationLogger.debug("Value has this " + value);
             int index = value.indexOf(':');
             return new ApproveVO(value.substring(0, index), value
             .substring(index + 1));
             }
            
             @Override
             public String getAsString(FacesContext context, UIComponent component,
             Object value) {
             NominationLogger.debug("getAsString executed...");
             NominationLogger.debug("Value has this " + value.toString());
             ApproveVO approveVO = (ApproveVO) value;
             return approveVO.getIconURI() + ":" + approveVO.getLabel();
             }
            



            i tried debugging and can clearly see what is intended is happening..at converter and in equals and hascode method of my VO. In the sense i can see unique hashcode for different objects and same hascode for same objetcs.

            please help

            • 3. Re: rich:listShuttle problem
              Ilya Shaikovsky Master

              also replace this

              private ArrayList<ApproveVO> approvedList = new ArrayList<ApproveVO>();
               private ArrayList<ApproveVO> nominatedList = new ArrayList<ApproveVO>();
              


              with

              private List<ApproveVO> approvedList = new ArrayList<ApproveVO>();
               private List<ApproveVO> nominatedList = new ArrayList<ApproveVO>();
              


              • 4. Re: rich:listShuttle problem
                Shivaji Byrapaneni Newbie

                same problem with List as well , i even tried collection and String array as well

                but the same problem....

                please help

                • 5. Re: rich:listShuttle problem
                  Daniel Margreth Newbie

                  Hello

                  We have a similar problem. Have you found a solution to your problem?

                  Thanks for you answer

                  Daniel