日期:2014-05-17  浏览次数:20640 次

struts2 同时从页面转换多个对象到action
如题,在页面上有几个不同的对象(User、UserPost),一起保存,
写法如下:
<s:textfield name="user.userName"/>
<s:textfield name="userPost.postId"/>

在action中能否得到几个同的对象呢?

我保存时报错:
ognl.OgnlException: target is null for setProperty(null, "postId", [Ljava.lang.String;@cc1e5a)


请大家指教,谢谢!

------解决方案--------------------
postId在userPost类中有没有设置get和set方法,userPost在action中有没有get set方法