1 4 package hero.struts.forms; 5 6 7 import javax.servlet.http.HttpServletRequest ; 8 import org.apache.struts.action.ActionError; 9 import org.apache.struts.action.ActionErrors; 10 import org.apache.struts.action.ActionForm; 11 import org.apache.struts.action.ActionMapping; 12 13 14 25 26 27 public final class ProjectForm extends ActionForm { 28 29 31 34 private String name = null; 35 36 39 private String oldName = null; 40 41 42 43 45 46 50 public String getName() { 51 return (name); 52 } 53 54 58 public void setName(String name) { 59 this.name = name; 60 } 61 62 66 public String getOldName() { 67 return (oldName); 68 } 69 70 74 public void setOldName(String oldName) { 75 this.oldName = oldName; 76 } 77 78 80 86 public void reset(ActionMapping mapping, HttpServletRequest request) { 87 this.oldName = null; 88 89 } 90 91 92 102 public ActionErrors validate(ActionMapping mapping, 103 HttpServletRequest request) { 104 ActionErrors errors = new ActionErrors(); 105 if (name == null || name.length()==0) 106 errors.add("name", 107 new ActionError("error.projectname.required")); 108 109 if (oldName == null || oldName.length()==0) 110 errors.add("olName", 111 new ActionError("error.oldName.required")); 112 113 return (errors); 114 } 115 116 117 118 } 119 120
| Popular Tags
|