如何获取Struts2里的循环数值

leemny 08-01-07

我有这样一个页面
test.jsp

....
<s:iterator value="list" status="cl">

<s:checkbox name="check%{id}" theme = "simple" value="%{ischeck}"/>
<s:property value="name" />
</s:iterator>

...

意思就是,循环读取list的内容,显示name,并且在name前加个checkbox框,以后的函数将检验页面checkbox
的状态

但是问题出来了,在post以后,后台将会输出如下错误
16:43:59,174 ERROR ParametersInterceptor:204 - ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'check1' on 'class sloa.action.RoleSetAction: Error setting expression 'check1' with value '[Ljava.lang.String;@8c0162'
16:43:59,174 ERROR ParametersInterceptor:204 - ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'check10' on 'class sloa.action.RoleSetAction: Error setting expression 'check10' with value 'false'
16:43:59,184 ERROR ParametersInterceptor:204 - ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'check11' on 'class sloa.action.RoleSetAction: Error setting expression 'check11' with value 'false'
16:43:59,184 ERROR ParametersInterceptor:204 - ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'check12' on 'class sloa.action.RoleSetAction: Error setting expression 'check12' with value 'false'
16:43:59,184 ERROR ParametersInterceptor:204 - ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'check13' on 'class sloa.action.RoleSetAction: Error setting expression 'check13' with value 'false'
16:43:59,254 ERROR ParametersInterceptor:204 - ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'check14' on 'class sloa.action.RoleSetAction: Error setting expression 'check14' with value 'false'
16:43:59,254 ERROR ParametersInterceptor:204 - ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'check15' on 'class sloa.action.RoleSetAction: Error setting expression 'check15' with value 'false'
16:43:59,254 ERROR ParametersInterceptor:204 - ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'check16' on 'class sloa.action.RoleSetAction: Error setting expression 'check16' with value 'false'
16:43:59,264 ERROR ParametersInterceptor:204 - ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'check17' on 'class sloa.action.RoleSetAction: Error setting expression 'check17' with value 'false'
16:43:59,284 ERROR ParametersInterceptor:204 - ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'check18' on 'class sloa.action.RoleSetAction: Error setting expression 'check18' with value 'false'
16:43:59,294 ERROR ParametersInterceptor:204 - ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'check19' on 'class sloa.action.RoleSetAction: Error setting expression 'check19' with value 'false'


大概意思就是,要定义诸如check1的方法,才能获取checkbox1的内容
那么问题出来了
我的list是动态的,我不可能知道有多少checkbox,所以也不可能定义一大堆比如check1,check2一类的函数
来获取checkbox内容
那么有没有别的方法来获取呢?
谢谢各位

leemny
2008-01-07 17:04

我在action里定义了很多函数比如public void setCheck(List<String> check)一类的都不好使

gougou3250
2008-01-09 22:13

Error setting expression 'check10' with value 'false'
类型有没有问题