selectedItems shouldn't be a List<SelectItem>.  It
should be a List<whateverTheValueOfYourSelectItems>.

If your selectItems have a value that is String, selectedItems
should be List<String>.

A hint:  use selectManyListbox, even h:selectManyListbox.
Then take *exactly* that code and just switch the tag to
<tr:selectOrderShuttle>.  If you know how to use
selectManyListbox or selectManyCheckbox, you know
how to use selectManyShuttle and selectOrderShuttle.

-- Adam


On 10/20/06, Scott Wall <[EMAIL PROTECTED]> wrote:
I am trying to use a selectOrderShuttle component to allow users to select
several elements from an array of <f:selectItems>. This is done in an ADF
dialog framework separate dialog that I would then like to return a
java.util.List of objects to the backing bean of the page that opens the
dialog. However, the array that is returned has 0 elements. I have gone over
and over this trying many different iterations such as:

<%@ taglib uri="http://myfaces.apache.org/adf/faces/html"; prefix="trh" %>
 <%@ taglib uri="http://myfaces.apache.org/adf/faces"; prefix="tr" %>
<%@ taglib uri="http://java.sun.com/jsf/core"; prefix="f" %>

<f:view>
<trh:html>
<trh:head title="Edit Diagnosis Dialog"/>

<trh:body>
<tr:form>

<tr:selectOrderShuttle value="#{backing_EditDiagnosis.selectedItems}"
binding="#{backing_EditDiagnosis.shuttle}">
  <f:selectItems value="#{applicationParams.diagnoses}"/>
</tr:selectOrderShuttle>

<tr:commandButton text="OK" action="#{backing_EditDiagnosis.submitForm}"/>

</tr:form>
</trh:body>
</trh:html>
</f:view>

backing_EditDiagnosis is a session-scoped backing bean...

import java.util.*;
import org.apache.myfaces.context.AdfFacesContext;
import org.apache.myfaces.adf.component.core.input.CoreSelectOrderShuttle;

public class EditDiagnosis {

private ArrayList<SelectItem> selectedItems = new ArrayList<SelectItem>();
private CoreSelectOrderShuttle shuttle;

  public String submitForm() {
    for(SelectItem i  : selectedItems) {
      System.out.println("Item: " + i.getLabel());
    }
    AdfFacesContext.getCurrentInstance().returnFromDialog(null,null);
    return null;
  }

...getters/setters for selectedItems, shuttle

}

...applicationParams.diagnoses returns a SelectItem[]...

but I can never get selectedItems to have anything other than a size()=0.
What am I doing wrong?

Thanks in advance,
Scott


Reply via email to