1 5 package servletunit.struts.tests; 6 7 import org.apache.struts.action.ActionForm; 8 import org.apache.struts.action.ActionMapping; 9 10 import javax.servlet.http.HttpServletRequest ; 11 12 public class ComplexForm extends ActionForm { 13 14 private Object complexObject; 15 private String username; 16 private String password; 17 18 public String getUsername() { 19 if (username != null) 20 return username; 21 else 22 return ""; 23 } 24 25 public void setUsername(String username) { 26 this.username = username; 27 } 28 29 public String getPassword() { 30 if (password != null) 31 return password; 32 else 33 return ""; 34 } 35 36 public void setPassword(String password) { 37 this.password = password; 38 } 39 40 public Object getComplexObject() { 41 return complexObject; 42 } 43 44 public void setComplexObject(Object complexObject) { 45 this.complexObject = complexObject; 46 } 47 48 public void reset(ActionMapping mapping, HttpServletRequest request) { 49 String testFlag = request.getParameter("test.reset"); 50 if ((testFlag != null) && (testFlag.equals("true"))) { 51 this.setComplexObject(null); 52 this.setPassword(null); 53 this.setUsername(null); 54 } 55 } 56 57 58 } 59 | Popular Tags |