1 package formbean; 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 final class GalleryForm extends ActionForm { 11 12 private String galleryName = null; 13 14 public void setGalleryName(String value) { 15 galleryName = value; 16 } 17 public String getGalleryName() { 18 return galleryName; 19 } 20 21 27 public void reset(ActionMapping mapping, HttpServletRequest request) { 28 this.galleryName = null; 29 } 30 31 41 public ActionErrors validate( 42 ActionMapping mapping, 43 HttpServletRequest request) { 44 45 ActionErrors errors = new ActionErrors(); 46 if ((galleryName == null) || (galleryName.length() < 1)) 47 errors.add( 48 "galleryName", 49 new ActionError("error.galleryname.required")); 50 51 return errors; 52 53 } 54 } | Popular Tags |