收集表单的页面:
1
struts.xml里:
<action name="listAction1" class="com.xsl.action.ListAction1">
<result name="success">/success.jsp</result> </action>ListAction1.java里:
1 package com.xsl.action; 2 3 import java.util.ArrayList; 4 import java.util.List; 5 6 import javax.servlet.http.HttpServletRequest; 7 8 import org.apache.struts2.interceptor.ServletRequestAware; 9 10 import com.opensymphony.xwork2.ActionSupport;11 import com.xsl.entity.Dog;12 import com.xsl.entity.Users;13 14 public class ListAction1 extends ActionSupport implements ServletRequestAware {15 private Users users;16 private HttpServletRequest request;17 private Listulist;18 public String insert(){19 for(Users u:ulist){20 System.out.println(u.getDog().getDid()+"---"+u.getDog().getDname());21 }22 return SUCCESS;23 }24 public void setServletRequest(HttpServletRequest request) {25 this.request = request;26 }27 public Users getUsers() {28 return users;29 }30 public void setUsers(Users users) {31 this.users = users;32 }33 public HttpServletRequest getRequest() {34 return request;35 }36 public void setRequest(HttpServletRequest request) {37 this.request = request;38 }39 public List getUlist() {40 return ulist;41 }42 public void setUlist(List ulist) {43 this.ulist = ulist;44 }45 }