action里边这么写:
HttpServletRequest request = ServletActionContext.getRequest();
request.setAttribute("listname",list);其中listname为自定义的名字,list为你查出来的集合
jsp里边这么接收:
<s:iterator value="#request.listname" status="var">
<tr><td>
<input name="variableName"type="text" value="<s:property value="variableName" />" />
</td></tr>
</s:iterator> variableName 为变量名称
支持多行数据的提取
今天做项目的时候,由于要用到在Struts2的Action类中利用Spring的AOP来实现记录操作日志,在Action里面的方法中加上自定义annotation来实现记录操作功能,运行的时候页面提示NoSuchMethodException when Aspec,网上说是Action继承了ActionSupport导致的,后来在一个英文网站上找到了解决的方法,只要在Spring的配置文件applicationContext中的<aop:aspectj-autoproxy/>改为<aop:aspectj-autoproxy proxy-target-class="true"/>就可以了。
英文网站的地址是:http://forum.springsource.org/showthread.php?t=51758,原文如下: