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 24 25 26 public final class NodeForm extends ActionForm { 27 28 30 33 private String name = null; 34 35 36 38 39 43 public String getName() { 44 return (name); 45 } 46 47 51 public void setName(String name) { 52 this.name = name; 53 } 54 55 57 63 public void reset(ActionMapping mapping, HttpServletRequest request) { 64 this.name = null; 65 66 } 67 68 69 79 public ActionErrors validate(ActionMapping mapping, 80 HttpServletRequest request) { 81 ActionErrors errors = new ActionErrors(); 82 if (name == null || name.length()==0) 83 errors.add("name", 84 new ActionError("error.name.required")); 85 return (errors); 86 } 87 88 89 90 } 91 92 | Popular Tags |