1 package org.nextime.ion.backoffice.form; 2 3 import javax.servlet.http.HttpServletRequest ; 4 5 import org.apache.struts.action.ActionError; 6 import org.apache.struts.action.ActionErrors; 7 import org.apache.struts.action.ActionForm; 8 import org.apache.struts.action.ActionMapping; 9 10 public class CreateUserForm extends ActionForm { 11 12 private String name; 13 private String email; 14 private String password; 15 private String login; 16 private String [] groups; 17 18 21 public ActionErrors myValidate(HttpServletRequest request) { 22 ActionErrors errors = new ActionErrors(); 23 if ("".equals(getName()) || getName()==null) { 24 ActionError error = 25 new ActionError("error.createUser.nameMissing"); 26 errors.add("name", error); 27 } 28 if ("".equals(getEmail()) || getEmail()==null) { 29 ActionError error = 30 new ActionError("error.createUser.emailMissing"); 31 errors.add("email", error); 32 } 33 if ("".equals(getLogin()) || getLogin()==null) { 34 ActionError error = 35 new ActionError("error.createUser.loginMissing"); 36 errors.add("login", error); 37 } 38 if ("".equals(getPassword()) || getPassword()==null) { 39 ActionError error = 40 new ActionError("error.createUser.passwordMissing"); 41 errors.add("password", error); 42 } 43 return errors; 44 } 45 46 49 public void reset(ActionMapping arg0, HttpServletRequest arg1) { 50 setName(null); 51 setEmail(null); 52 setGroups(null); 53 setPassword(null); 54 setLogin(null); 55 } 56 57 58 62 public String getEmail() { 63 return email; 64 } 65 66 67 71 public String [] getGroups() { 72 return groups; 73 } 74 75 76 80 public String getName() { 81 return name; 82 } 83 84 85 89 public void setEmail(String email) { 90 this.email = email; 91 } 92 93 94 98 public void setGroups(String [] groups) { 99 this.groups = groups; 100 } 101 102 103 107 public void setName(String name) { 108 this.name = name; 109 } 110 111 112 116 public String getPassword() { 117 return password; 118 } 119 120 121 125 public void setPassword(String password) { 126 this.password = password; 127 } 128 129 130 134 public String getLogin() { 135 return login; 136 } 137 138 139 143 public void setLogin(String login) { 144 this.login = login; 145 } 146 147 148 } 149 | Popular Tags |