I am using seam 2.2.2.Final on JBoss AS 5. I am working on a multi-page wizard.On my first page, user will be able to enter several business names separated by a new line on a textarea.
<s:decorate id="businessNameTextAreaField" template="layout/edit.xhtml">
                    <ui:define name="label">Business Names</ui:define>
                    <h:inputTextarea id="businessNameTextArea"
                                   cols="80"
                                   rows="3"
                               required="true"
                                  value="#{businessNameHome.instance.businessNameTextArea}"/>
            </s:decorate>
Upon submission of the page, the system parses the inputed value and splits it into a list of strings
      public String checkBusinessNames(){
            String businessNameTextArea = this.getInstance().getbusinessNameTextArea();
            String[] businessNameTextAreaArray = businessNameTextArea.split("\\n");
            List<SelectItem> businessNameChoices = new ArrayList<SelectItem>();
            for(String businessNameText: businessNameTextAreaArray){           
                businessNameChoices.add(new SelectItem(businessNameText));
            }
            this.getInstance().setBusinessNameChoices(businessNameChoices);
            return "valid";
      }
The user is then asked to select from the list of valid business names to register
<s:decorate id="businessNameRegisterListField" template="layout/edit.xhtml">
 <ui:define name="label">Business Name</ui:define>
 <h:selectManyCheckbox  value="#{businessNameHome.instance.selectedbusinessName}" layout="pageDirection" immediate="true" >
 <s:selectItems value="#{businessNameHome.instance.businessNameChoices}" var="bn" label="#{bn.label}" />                                                                                      </h:selectManyCheckbox>                            
  </s:decorate>
selectedbusinessName is of type String while businessNameChoices is of List
Upon submission of the page, what is submitted as business names is something like this:
javax.faces.model.SelectItem@135aa7c
I have tried putting an itemValue on the s:selectItems but I get another error which is "Value is not valid"
Tried to use <s:convertEntity> but gets a NumberFormatException
I have also tried to create my own converter
public class BusinessNameBeanConverter implements javax.faces.convert.Converter {
        @Override
        public Object getAsObject(FacesContext context, UIComponent cmp, String value)      {
            // TODO Auto-generated method stub
            System.out.println("getAsObject "+value);
            return value;
        }
        @Override
        public String getAsString(FacesContext context, UIComponent cmp, Object value) {
            // TODO Auto-generated method stub
            System.out.println("getAsString "+((SelectItem)value).getValue());
            return ((SelectItem)value).getValue();
        }
    }
but I still get the same "Value is not valid" error.
I don't know what to do anymore. Please help.
Thanks,
Nicholas
 
    