67,550
社区成员




<s:iterator id="a" value="#Map.keySet()">
<s:set name="father" value="#a" scope="request"/>
<s:property value="#father.aa"/>(<s:property value="#father.ab"/>)
<s:iterator value="#menuMap.get(#a)" id="child">
<s:property value="#child.ba"/>(<s:property value="#child.bb"/>())
</s:iterator>
</s:iterator>
<s:iterator value="map.keySet()" id="bookId">
<tr>
<td>
<s:property value="map.get(#bookId)"/>
</td>
</tr>
</s:iterator>
public List<TestViewObject> getList() {
return list;
}
<s:property value="userOne" />
<s:property value="userTwo" />
private String userOne;
private String userTwo;
public List<TestViewObject> getList() {
return list;
}
<s:property value="userOne" />
<s:property value="userTwo" />
private String userOne;
private String userTwo;
public class TestViewObject {
private String userOne;
private String userTwo;
private String userThree;
public String getUserOne() {
return userOne;
}
public void setUserOne(String userOne) {
this.userOne = userOne;
}
public String getUserTwo() {
return userTwo;
}
public void setUserTwo(String userTwo) {
this.userTwo = userTwo;
}
public String getUserThree() {
return userThree;
}
public void setUserThree(String userThree) {
this.userThree = userThree;
}
}
import java.util.ArrayList;
import java.util.List;
import struts.vo.TestViewObject;
import com.opensymphony.xwork2.ActionSupport;
public class TestAction extends ActionSupport {
/**
*
*/
private static final long serialVersionUID = 1L;
private TestViewObject vo;
List<TestViewObject> list;
public TestViewObject getVo() {
return vo;
}
public void setVo(TestViewObject vo) {
this.vo = vo;
}
public List<TestViewObject> getList() {
return list;
}
public String execute() throws Exception {
TestViewObject vo;
list = new ArrayList<TestViewObject>();
for (int i = 0; i < 3; i++) {
vo = new TestViewObject();
vo.setUserOne(i + " gaga");
vo.setUserTwo(i + " dudu");
vo.setUserThree(i + " haha");
list.add(vo);
}
return "success";
}
}
<?xml version="1.0" encoding="GBK" ?>
<!--指定struts2配置文件的DTD信息-->
<!DOCTYPE struts PUBLIC
"-//apache Software Foundation//DTD Struts Configuation 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<!-- struts 是struts2配置文件的根元素-->
<struts>
<include file="struts-default.xml"></include>
<!--struts2的Action必须放在指定的包空间下定义-->
<package name="test" extends="struts-default">
<action name="testAction" class="TestAction">
<result>/success.jsp</result>
</action>
</package>
</struts>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
<body>
<s:iterator value="list">
<s:property value="userOne" />
<s:property value="userTwo" />
</s:iterator>
</body>
</html>