among the logic:iterate tags, there are 3 attributes which are needed to specify the collection to be iterated in the jsp page. They are :
1. Collection : which is a runtime expression that evaluates to a collection
2. name : which is the name of the jsp bean containing the collection to be iterated over
3. property : the name of the property of the jsp bean specified by name( point 2)
In all those 3 attributes, you need to have a jsp bean which has a collection member variable to be iterated over.
So, In your case, you cant put the arraylist directly to the request object. you can define a jsp bean, declaring one arraylist, fill the arraylist with the arraylist returned by your getDepartments method. The next step is put the jsp bean in the request object.
then in the jsp you can have logic:iterate tag
which will look like :
<logic:iterate name="depatrmentBean" property="departments" id="row" indexId="index" scope="request" >
where the departmentBean is your jsp bean(refered by the name attribute). In the the departmentBean you need to have an ArrayList named departments(refered by property attributed).
and then you can use html:text/bean:write to output each member variables.
<html:text property='<%= "department["+index+"].deptId" %>' >
you might be a bit confused. We have "departments" (see the name attribute)and department(see the property attribute of html:text tag). They represent two different things.
departments is the collection you want to iterate over, and the department, is the object contained in the arraylist.
hope this can help