3 Replies Latest reply on Aug 30, 2010 5:03 AM by nbelaevski

    orderingList Error with Getting Selection - Severity=(ERROR

    echua

      I get the following error

      INFO: WARNING: FacesMessage(s) have been enqueued, but may not have been displayed.
      sourceId=storelistform2:orderingListStore[severity=(ERROR 2), summary=("Component storelistform2:orderingListStore has invalid value expression Store [1] by Beewhole"), detail=("Component storelistform2:orderingListStore has invalid value expression Store [1] by Beewhole")]



      I am trying to just get the user selected row in a orderingList. What am I doing wrong?

      I have a converter

      public class StoreConverter implements Converter {

      /* (non-Javadoc)
      * @see javax.faces.convert.Converter#getAsObject(javax.faces.context.FacesContext, javax.faces.component.UIComponent, java.lang.String)
      */
      public Object getAsObject(FacesContext context, UIComponent component,
      String value) {
      int index1 = value.indexOf(':');
      int index2 = value.lastIndexOf(':');


      return new Store(Integer.valueOf(value.substring(0, index1)), value.substring(index1 + 1,index2),value.substring(index2+1));
      }

      /* (non-Javadoc)
      * @see javax.faces.convert.Converter#getAsString(javax.faces.context.FacesContext, javax.faces.component.UIComponent, java.lang.Object)
      */
      public String getAsString(FacesContext context, UIComponent component,
      Object value) {

      Store storeItem = (Store) value;
      return (storeItem.getStoreid() + ":" + storeItem.getName() +":" + storeItem.getDescription());
      }

      }


      and here is my orderingList


      <h:form id="storelistform2">
      <rich:orderingList id="orderingListStore" value="#{sysUsers.storeList}" var="store" controlsType="button" listHeight="150" listWidth="350"
      selection="#{sysUsers.selection}" converter="#{storeConverter}" >
      <h:column width="50px">
      <f:facet name="header">
      <h:outputText value="StoreID" />
      </f:facet>
      <h:outputText value="#{store.storeid}"></h:outputText>
      </h:column>
      <h:column>
      <f:facet name="header">
      <h:outputText value="Store Name" />
      </f:facet>
      <h:outputText value="#{store.name}"></h:outputText>
      </h:column>
      <h:column>
      <f:facet name="header">
      <h:outputText value="Description" />
      </f:facet>
      <h:outputText value="#{store.description}"></h:outputText>
      </h:column>
      </rich:orderingList>
      <a4j:commandButton id="submitLButton" value="Submit" action="#{sysUsers.showPreview}" />

      </h:form>


      I use hibernate in my bean to get the list. Nay one had this problem??

        • 1. Re: orderingList Error with Getting Selection - Severity=(ER
          ilya_shaikovsky

          converter should be defined. And for item hashCode and equals methods properly overrided.

          check demosite lsitShuttle example.

          • 2. Re: orderingList Error with Getting Selection - Severity=(ER
            deanhiller

            for me, deleting hashCode/equals in the entity fixed even though eclipse correctly generated my equals/hashCode methods...(must be a bug in 3.3.3-Final)

             

            //HAVING equals/hashCode breaks rich:orderedList widget...
            //    @Override
            //    public int hashCode() {
            //        final int prime = 31;
            //        int result = 1;
            //        result = prime * result + ((id == null) ? 0 : id.hashCode());
            //        return result;
            //    }
            //
            //    @Override
            //    public boolean equals(Object obj) {
            //        if (this == obj)
            //            return true;
            //        if (obj == null)
            //            return false;
            //        if (getClass() != obj.getClass())
            //            return false;
            //        Question other = (Question) obj;
            //        if (id == null) {
            //            if (other.id != null)
            //                return false;
            //        } else if (!id.equals(other.id))
            //            return false;
            //        return true;
            //    }

            • 3. Re: orderingList Error with Getting Selection - Severity=(ER
              nbelaevski

              Hi,

               

              Can you please post beans/page code for investigation?