struts2 jsp传list参数到action中的问题
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产生冲突
<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产生冲突
...全文
相关推荐
Struts2 JSP中将list,set ,Map传递到Action然后<s:iterator>遍历(三十五)
在Struts2框架中,开发Web应用时常常需要在JSP页面与Action之间传递数据,以便于展示或者处理。
struts2中action接收参数的方式
在Struts2框架中,Action类是业务逻辑处理的核心组件,它负责接收用户请求并进行相应的处理。Action类中的方法通常对应着用户界面的各个操作,而这些方法的参数则是用来接收前端请求传递的数据。
action 和jsp
下面将详细介绍Struts2框架中的参数传递方式。1. **使用Struts2标签库**:Struts2提供了丰富的标签库,可以方便地在JSP页面中使用。
struts1.2 from表单提交包含list的对象
首先,让我们来了解Struts1.2中的表单提交流程。当用户在Web页面上填写表单并点击提交按钮时,浏览器会发送一个HTTP请求到服务器。
struts2的方式返回json到jsp页面 List,Map,Object,对象各种操作都有....MyEclipse的,导入直接看效果。
该项目演示了如何使用Struts2框架将List、Map、Object等Java对象转换为JSON数据并返回至JSP页面。前端通过jQuery发起Ajax请求获取数据,实现动态页面更新。项目包含完整的


