action: package ch7.example5; import java.util.ArrayList; import java.util.List; import com.opensymphony.xwork.ActionSupport; public class TestFreemarker extends ActionSupport ... { List members=new ArrayList(); public TestFreemarker()...{ Member m1=new Member(); m1.setEmail("gaoxiang1@tom.com"); m1.setFirstname("gao1"); m1.setLastname("xiang1"); Member m2=new Member(); m2.setEmail("gaoxiang2@tom.com"); m2.setFirstname("gao2"); m2.setLastname("xiang2"); Member m3=new Member(); m3.setEmail("gaoxiang3@tom.com"); m3.setFirstname("gao3"); m3.setLastname("xiang3"); members.add(m1); members.add(m2); members.add(m3); }public String execute() throws Exception ...{ return SUCCESS;}public List getMembers() ...{ return members;}public void setMembers(List members) ...{ this.members = members;} } freemarker模板 < html > < body > < #list members as member > < li > ${member.email}-${member.firstname}-${member.lastname} </ li > </ #list > </ body > </ html > 配置文件: 特别注意的是result type是freemarker,前提是必须引用了welcome-default.xml < action name ="testfreemarker" class ="ch7.example5.TestFreemarker" > < result name ="success" type ="freemarker" > /ch7/list-members.ftl </ result > </ action >