发帖    主题    评论    推荐    标签    作者    订阅    查搜    注册   登陆   关注
 
面向对象 设计模式 领域驱动设计 企业架构 框架 开发教程 微服务 CQRS 扩展性 并发编程 事件溯源 分布式 SOA

如何获取Struts2里的循环数值

2008-01-07 17:03
赞助商链接

我有这样一个页面
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内容
那么有没有别的方法来获取呢?
谢谢各位

2008-01-07 17:04

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

2008-01-09 22:13

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

赞助商链接

赞助商链接

返回顶部

移动版 关于本站 使用帮助 联系管理员 最佳分辨率1366x768
OpenSource JIVEJDON Powered by JdonFramework Code © 2002-20 jdon.com