2 Replies Latest reply on Nov 3, 2008 5:28 PM by Nick Belaevski

    How bind object with multiple fields?

    Nunya Briss Newbie

      How does one bind an object that has >1 field in a rich:picklist or other tag requiring a converter?

      I have an ExperimentSpec object, that has a List of LabEquipment objects. LabEquipment has multiple fields: int id, String name, String vendor, String imageLink.

      I'm trying to create an addExperimentSpec.xhtml page, where the user can add a new ExperimentSpec to the database. In this page the user would select from a rich:picklist of LabEquipment objects, displayed by name, like this:

      <rich:picklist>
      <c:forEach var="equip" items="#{labEquipment}">
      <f:selectItem itemValue="#{equip}" itemLabel="#{equip.name}"/>
      </c:forEach>
      </rich:picklist>

      This doesn't work, because I need a converter. Unfortunately, I can't see how to create a converter, because I have >1 field... I can convert the LabEquipment to a String name, but I can't convert the String name to a LabEquipment object - I lose the id, vendor, imageLink fields...

      Is it even possible to bind multi-field objects to a RichFaces tag, other than a DataTable? It would be nice to be able to do this, b/c all of the objects I'm attempting to bind fit easier in my complex many-many data model.

      Thanks,
      Nunya