在学习struts 2 in action这本书的时候遇到了一个问题。先上书本的例程代码
jsp内容:<s:form action="ListDataTransferTest">
<s:textfield name="users[0].username" label="Usernames"></s:textfield>
<s:textfield name="users[1].username" label="Usernames"></s:textfield>
<s:textfield name="users[2].username" label="Usernames"></s:textfield>
<s:submit></s:submit>
</s:form>java文件内容
private List users;
public List getUsers() {
return users;
}
public void setUsers(List users) {
this.users = users;
}
public String execute()
{
return SUCCESS;
}
然后在properties文件内为Action对象的List对象指定元素类型:Element_users=com.hd.diasfloc.actionPackage.chapterFive.util.User可以确定的配置好配置文件。但是结果:严重: ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'users[0].username' on 'class com.hd.diasfloc.actionPackage.chapterFive.DataTransferTest: Error setting expression 'users[0].username' with value '[Ljava.lang.String;@1b43dd2'
2012-4-1 9:42:27 com.opensymphony.xwork2.interceptor.ParametersInterceptor setParameters
严重: ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'users[1].username' on 'class com.hd.diasfloc.actionPackage.chapterFive.DataTransferTest: Error setting expression 'users[1].username' with value '[Ljava.lang.String;@1c35be0'
2012-4-1 9:42:27 com.opensymphony.xwork2.interceptor.ParametersInterceptor setParameters
严重: ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'users[2].username' on 'class com.hd.diasfloc.actionPackage.chapterFive.DataTransferTest: Error setting expression 'users[2].username' with value '[Ljava.lang.String;@72e884'照书上的说法是不需要预先初始化任何一个List,也不需要类型说明。而且也在properties文件里指定了List属性的类型。
然后在java代码里面的List改为List<User>就没有问题了,这是为啥呢?希望各位大侠指教
jsp内容:<s:form action="ListDataTransferTest">
<s:textfield name="users[0].username" label="Usernames"></s:textfield>
<s:textfield name="users[1].username" label="Usernames"></s:textfield>
<s:textfield name="users[2].username" label="Usernames"></s:textfield>
<s:submit></s:submit>
</s:form>java文件内容
private List users;
public List getUsers() {
return users;
}
public void setUsers(List users) {
this.users = users;
}
public String execute()
{
return SUCCESS;
}
然后在properties文件内为Action对象的List对象指定元素类型:Element_users=com.hd.diasfloc.actionPackage.chapterFive.util.User可以确定的配置好配置文件。但是结果:严重: ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'users[0].username' on 'class com.hd.diasfloc.actionPackage.chapterFive.DataTransferTest: Error setting expression 'users[0].username' with value '[Ljava.lang.String;@1b43dd2'
2012-4-1 9:42:27 com.opensymphony.xwork2.interceptor.ParametersInterceptor setParameters
严重: ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'users[1].username' on 'class com.hd.diasfloc.actionPackage.chapterFive.DataTransferTest: Error setting expression 'users[1].username' with value '[Ljava.lang.String;@1c35be0'
2012-4-1 9:42:27 com.opensymphony.xwork2.interceptor.ParametersInterceptor setParameters
严重: ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'users[2].username' on 'class com.hd.diasfloc.actionPackage.chapterFive.DataTransferTest: Error setting expression 'users[2].username' with value '[Ljava.lang.String;@72e884'照书上的说法是不需要预先初始化任何一个List,也不需要类型说明。而且也在properties文件里指定了List属性的类型。
然后在java代码里面的List改为List<User>就没有问题了,这是为啥呢?希望各位大侠指教
解决方案 »
- jquery+json+struts2+spring ajax回调函数不执行
- 用apache的FTPClient上传一个文件,传上去后是空文件
- struts2 Action重复执行,急!
- 求助 hibernate 级联查询问题
- ibatis 中查询结果涉及到多个数据表中的字段, 如何写resultMap???
- logic:equal 做下拉框定位的问题
- 急求jfreechart1.0版本
- 求助base64加密算法
- JMS可不可以实现服务器端的“推技术”?熟悉的人进来说说,多谢了
- 想让大家讨论下,在ejb web server 方面的好书都有那些,造福大家
- 如何让Myeclipse不显示感叹号
- json动态赋值问题
List<User>就没有问题了,能够访问getset方法