1 package hero.struts.forms; 2 3 import java.util.AbstractCollection ; 4 5 import javax.servlet.http.HttpServletRequest ; 6 import org.apache.struts.action.ActionError; 7 import org.apache.struts.action.ActionErrors; 8 import org.apache.struts.action.ActionForm; 9 import org.apache.struts.action.ActionMapping; 10 11 12 24 25 public final class ActivityForm extends ActionForm { 26 27 28 30 31 34 private String role = null; 35 36 37 40 41 private String deadline = null; 42 43 46 47 private String description = null; 48 49 52 53 private String type = null; 54 55 58 59 private String anticipable = null; 60 61 64 65 private String automatic = null; 66 67 69 70 73 public String getRole() { 74 75 return (this.role); 76 77 } 78 79 83 public void setRole(String role) { 84 85 this.role = role; 86 87 } 88 89 92 public String getDeadline() { 93 if(this.deadline.length()>10) 94 return (this.deadline.substring(0,10)); 95 else 96 return (this.deadline); 97 98 } 99 100 104 public void setDeadline(String deadline) { 105 106 this.deadline =deadline; 107 108 } 109 110 113 public String getDescription() { 114 115 return (this.description); 116 117 } 118 119 123 public void setDescription (String description) { 124 125 this.description = description; 126 127 } 128 129 132 public String getType() { 133 134 return (this.type); 135 136 } 137 138 142 public void setType (String type) { 143 this.type = type; 144 } 145 146 149 public String getAnticipable() { 150 151 return (this.anticipable); 152 153 } 154 155 159 public void setAnticipable (String anticipable) { 160 161 this.anticipable = anticipable; 162 163 } 164 165 168 public String getAutomatic() { 169 170 return (this.automatic); 171 172 } 173 174 178 public void setAutomatic (String automatic) { 179 180 this.automatic = automatic; 181 182 } 183 184 186 187 193 public void reset(ActionMapping mapping, HttpServletRequest request) { 194 195 this.role = null; 196 this.deadline = null; 197 this.description = null; 198 this.type = null; 199 } 200 201 211 public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { 212 213 ActionErrors errors = new ActionErrors(); 214 215 if (role == null || role.length()==0) 216 errors.add("role", 217 new ActionError("error.role.required")); 218 if (deadline == null || deadline.length()==0) 219 errors.add("deadline", 220 new ActionError("error.deadline.required")); 221 if (description == null || description.length()==0) 222 errors.add("description", 223 new ActionError("error.description.required")); 224 225 return (errors); 226 227 } 228 } 229
| Popular Tags
|