struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jon D Cruz <>
Subject [Struts2] CheckBoxList returns XWorkList instead of ArrayList
Date Wed, 17 Oct 2007 17:56:42 GMT

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
*** 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 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");



The code that's in the JSP:

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


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

What I'm getting back from "valueslist" and "valuesArrayList" via

	class com.opensymphony.xwork2.util.XWorkList

View this message in context:
Sent from the Struts - User mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message