This is probably simple and I think I'm close, but I can't quite get
it to work: the proper ognl expression to use to get the value of a
checkbox w/in nested iterator tags.
I've got an ArrayList of Parent objects called parentList. Each
Parent object contains another array of Child objects called
childList. A Child object has an boolean field called "selected."
If I nest the iterators like so:
<s:iterator value="parentList" status="parentliststatus">
<s:iterator value="childList" status="childliststatus">
Then what would be the correct expression to use for a checkbox to get
the value of selected? I tried the following, but it doesn't seem to
work:
<s:checkbox name="%{'parentList['+#parentliststatus.index
+'].childList['+#childliststatus.index+'].selected'}"
value="selected"></s:checkbox>
That, in turn, produces some html like this:
<input type="checkbox" name="parentList[1].childList[2].selected"
value="true" checked="checked"
id="commentsPrint_parentList_1__childList_2__selected"/>
<input type="hidden"
name="__checkbox_parentList[1].childList[2].selected" value="true" />
But, that doesn't appear to work. I continue to get setParameter
errors when I submit the form:
DEBUG com.opensymphony.xwork2.interceptor.ParametersInterceptor -
Setting params parentList[1].childList[2].selected => [ true ]
ERROR com.opensymphony.xwork2.interceptor.ParametersInterceptor -
ParametersInterceptor - [setParameters]: Unexpected Exception caught
setting 'parentList[1].childList[2].selected' on 'class
com.blackstream.yardly.actions.comments.CommentsPrintAction: Error
setting expression 'parentList[1].childList[2].selected' with value
'[Ljava.lang.String;@6d650f'
Any ideas what I'm doing wrong?
Kevin