Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

[S2] s:iterator and s:checkboxlist inside (using 2.0.2 trunk)

Dariusz Wojtas

2006-12-22

Replies:

Hi,

I have such properties in my action:

private ArrayList<Extension> extensionGroups = null;
private HashMap<String, ArrayList<Extension>> groupedExtensions = null;

The 1st list contains only some 'Extension' elements.
The 2nd map contains other lists of extensions (values) with some
property (treeNo) from the parent used as the key.
Then I have a JSP page with such construct somewhere in it:

 <s:iterator value="extensionGroups">
   <b>${desc}</b><br />
   <s:checkboxlist
     list="groupedExtensions['${treeNo}']"
     listKey="name"
     listValue="desc"
     name="extensions"
     labelposition="right"
     />          
 </s:iterator>

And here is a strange thing:
When I start the app and run the action for the 1st time I get nice
result AS EXPECTED:

GROUP1
  chk: extension1
  chk: extension2
  chk: extension3
GROUP2
  chk: extension4
  chk: extension5

But after reloading the page (no extra params in the url, just plain
GET), the result is:

  chk: GROUP1
  chk: GROUP2

Looks like the context of the data beaing displayed is different.
But it's the same page! The same code and the same data.
After restarting the app it is again the same behaviour.
My debugs in the actions (getters) show that the same data is returned
in all cases.

What am I doing wrong?

Dariusz Wojtas

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.