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 EditUserForm extends ActionForm { 11 12 private String name; 13 private String email; 14 private String password; 15 private String [] groups; 16 17 20 public ActionErrors myValidate(HttpServletRequest request) { 21 ActionErrors errors = new ActionErrors(); 22 if ("".equals(getName()) || getName()==null) { 23 ActionError error = 24 new ActionError("error.editUser.nameMissing"); 25 errors.add("name", error); 26 } 27 if ("".equals(getEmail()) || getEmail()==null) { 28 ActionError error = 29 new ActionError("error.editUser.emailMissing"); 30 errors.add("email", error); 31 } 32 if ("".equals(getPassword()) || getPassword()==null) { 33 ActionError error = 34 new ActionError("error.editUser.passwordMissing"); 35 errors.add("password", error); 36 } 37 return errors; 38 } 39 40 43 public void reset(ActionMapping arg0, HttpServletRequest arg1) { 44 setName(null); 45 setEmail(null); 46 setGroups(null); 47 setPassword(null); 48 } 49 50 51 55 public String getEmail() { 56 return email; 57 } 58 59 60 64 public String [] getGroups() { 65 if( groups == null ) { 66 return new String [0]; 67 } 68 return groups; 69 } 70 71 72 76 public String getName() { 77 return name; 78 } 79 80 81 85 public void setEmail(String email) { 86 this.email = email; 87 } 88 89 90 94 public void setGroups(String [] groups) { 95 this.groups = groups; 96 } 97 98 99 103 public void setName(String name) { 104 this.name = name; 105 } 106 107 108 112 public String getPassword() { 113 return password; 114 } 115 116 117 121 public void setPassword(String password) { 122 this.password = password; 123 } 124 125 126 } 127 | Popular Tags |