struts2 jsp传list参数到action中的问题

duiduiaa duiduiaa 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
jsp 页面
<s:iterator id="pointDTO" value="pointList" status="count">
<s:hidden name="pointList[%{count.index}].pointCode">
<s:hidden name="pointList[%{count.index}].pointName">
<s:iterator id="dataSourceDTO" value="#pointDTO.dataSourceList" status="c">
<s:hidden name="pointList[%{count.index}].dataSourceList[%{c.index}].pointName">
</s:iterator>

</s:iterator>

pointDTO dataSourceDTO 分别为两个dto
在pointDTO中有一个属性是List<DataSourceDTO> dataSourceList; 有get和set方法

我再struts2的后台可以直接得到List<PointDTO> pointList这个参数 PointDTO有String pointCode,String pointName
和List<DataSourceDTO> dataSourceList 值 并且dataSourceList中还有dataSourceDTO的相关属性

问题是:我再对pointDTO 和dataSOurceDTO分别都重写了 equals和hasCode的方法后,在action中的pointList中我只能得到
PointDTO的pointCode,pointName属性,而dataSourceList为空

哪位高手知道为什么 怎么解决?
struts2 jsp往action中传递List的原理是什么?

怀疑 是struts将form中参数都放在map中 构造成List hashCode产生冲突
...全文
评论 8
收藏 已收藏
分享
返回顶部
duiduiaa
Java EE 67,535 成员 225,843 内容