I've been wracking my brains on this issue for the last day and wonder if
someone out there can help.

*** I'm using an ArrayList<Parent> to populate a CheckBoxList on my JSP.
*** The Parent object has an "id" and "name" field.
*** I'm using an ArrayList<String> to retrieve the values that have been
selected.
*** I'm expecting to see an ArrayList<String> coming back, but instead a
XWorkList is being returned.

I've worked with Struts1 and WebWork before, and I don't remember
using/seeing the XWorkList object before.

I've tried using the ######-conversion.properties process, but this will
only help convert the elements of the Collection.

*** Is there a way to have an ArrayList returned instead of the XWorkList?

I have a feeling I'm missing something basic...

The code that's in the Action:

        // Populate the checkboxlist with these...
        public List<Parent> testList = new ArrayList<Parent>();
        public ArrayList<Parent> testArrayList = new ArrayList<Parent>();

        // Retrieve the values selected from the form
        public ArrayList<String> valuesList = new ArrayList<String>();
        public ArrayList<String> valuesArrayList = new ArrayList<String>();

        //... Getters and Setters for the "values###" ...
        ...
        ...

        // Create the Parent objects to place in the Lists
        public void validate() {

                Parent parent1ForList = new Parent("Check 1");
                Parent parent2ForList = new Parent("Check 2");
                Parent parent3ForList = new Parent("Check 3");
        
                Parent parent1ForArrayList = new Parent("Check 1");
                Parent parent2ForArrayList = new Parent("Check 2");
                Parent parent3ForArrayList = new Parent("Check 3");

                testList.add(parent1ForList);
                testList.add(parent2ForList);
                testList.add(parent3ForList);
        
                testArrayList.add(parent1ForArrayList);
                testArrayList.add(parent2ForArrayList);
                testArrayList.add(parent3ForArrayList);

        }


The code that's in the JSP:

        CheckBoxList created from a "List":
        <BR><BR>
        <s:checkboxlist name="valuesList" list="testList" listKey="id"
listValue="name"/>

        <BR><BR>

        CheckBoxList created from a "ArrayList":
        <BR><BR>
        <s:checkboxlist name="valuesArrayList" list="testArrayList" listKey="id"
listValue="name"/>


What I'm getting back from "valueslist" and "valuesArrayList" via
"getClass()":

        class com.opensymphony.xwork2.util.XWorkList


Thanks
-- 
View this message in context: 
http://www.nabble.com/-Struts2--CheckBoxList-returns-XWorkList-instead-of-ArrayList-tf4642221.html#a13259251
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to