2 Replies Latest reply on Apr 7, 2008 9:23 PM by Paul Pantages

    ListShuttle validation when replacing sourceValue

    Paul Pantages Novice

      Richfaces 3.1.4.GA
      Seam 2.0.1.GA

      Hello forum,

      I am trying to use a pager with listShuttle. The reason for this is
      that my sourceValue (list) can be quite large, and I want the operator to be
      able to search, sort and page through the values to find what he
      wants, rather than have a huge list in the "sourceValue" column.

      I have implemented this and everthing works perfectly, except for the validation error
      (below). This error is always against the first item showing in my sourceValue, and
      happens when I try to page forward or backward. The page-forward works properly, and
      the first item on the new "page" will cause the next validation error if you page
      the sourcValue again.

      Other members of the list (item 2..n) do not show the validation
      errors, just the first one.

      In the implementation, when the user presses a page-forward button, I replace the
      "sourceValue" list with the values of the next page.

      The error does not have any effect on the operation, except the
      error log that is emitted.

      I created a validator for these objects & declared it in faces-config.xml, but I can
      see from debug printlns that the validator is never called.

      I thought that my a4j:commandLink (pager button) was submitting the sourcValue so I put an
      ajaxSinge=true on it to see if I could stop the error, but this also did not make any difference.

      I know that this usage of the shuttle in this way might be a bit unconventional... but, if anyone has any suggestion on what is wrong, please let me

      The errors look like this:

      2008-04-07 18:59:13,399 INFO [http-] javax.enterprise.resource.webcontainer.jsf.lifecycle
      WARNING: FacesMessage(s) have been enqueued, but may not have been displayed.
      sourceId=j_id30:j_id286[severity=(ERROR 2), summary=(j_id30:j_id286: Validation Error: Value rich-15310-1 is not valid), detail=(j_id30:j_id286: Validation Error: Value rich-15310-1 is not valid)]

      The backing for the sourceValue is just a List like so:
      private List<Service> availableServiceList;

      The list shuttle:
       sourceCaptionLabel="Available Segments"
       targetCaptionLabel="Included Segments"
       removeAllControlLabel="Remove all segments"
       removeControlLabel="Remove segment"
       copyControlLabel="Add segment"
       copyAllControlLabel="Add all segments"
       <c:forEach items="#{serviceTableRowFormats.columnDataModel}" var="column">
       <rich:column sortable="false">
       <f:facet name="header">
       value="#{serviceTableRowFormats.labelMap[column]} #{availableServiceMgmt.sortStatus[column]}"
       onclick="fsort3('#{column}')" />
       <h:outputText value="#{row[column]}"/>

      One of my pager buttons
       title="Page Forward"
       action="#{tablebean.pageForward}" >
       <ui:include src="/view/utils/toolicon.xhtml">
       <ui:param name="src" value="#{images.downArrow}"/>
       <ui:param name="alt" value="DownArrow"/>

        • 1. Re: ListShuttle validation when replacing sourceValue
          Nick Belaevski Master


          I guess the problem could be in hashCode()/equals() methods not redefined properly. listShuttle component validates list of submitted values against the list of model values, and it's failing that's why that validation failure occurs.

          • 2. Re: ListShuttle validation when replacing sourceValue
            Paul Pantages Novice

            Hello Nick, thank you for the reply.

            I do have the hashcode/equals methods properly defined.

            Is there any way to prevent the submission? I thought the ajaxSingle would do this for me, but it doesn't.

            I think the problem is due to me switching the sourceValue; I guess somewhere in the guts of richfaces or JSF something is validating the "old" values, which have been replaced with the next page of stuff... I would have expected this to be done before my action method (page command) was called, but I guess it is happening after.

            Do you know if there are any real consequences associated with the error? Everything seems to work properly despite the msg.

            I will try an immediate=true on my pager button and see if that helps.