1 package formbean; 2 3 import java.math.BigDecimal ; 4 5 import javax.servlet.http.HttpServletRequest ; 6 7 import org.apache.struts.action.ActionError; 8 import org.apache.struts.action.ActionErrors; 9 import org.apache.struts.action.ActionForm; 10 import org.apache.struts.action.ActionMapping; 11 12 public final class PaintingForm extends ActionForm { 13 14 private String paintingTitle = null; 15 private BigDecimal estimatedPrice = null; 16 private String artistName = null; 17 18 public void setEstimatedPrice(BigDecimal value) { 19 estimatedPrice = value; 20 } 21 public BigDecimal getEstimatedPrice() { 22 return estimatedPrice; 23 } 24 25 public void setPaintingTitle(String value) { 26 paintingTitle = value; 27 } 28 public String getPaintingTitle() { 29 return paintingTitle; 30 } 31 32 public void setArtistName(String value) { 33 artistName = value; 34 } 35 public String getArtistName() { 36 return artistName; 37 } 38 39 45 public void reset(ActionMapping mapping, HttpServletRequest request) { 46 47 this.estimatedPrice = null; 48 this.paintingTitle = null; 49 this.artistName = null; 50 51 } 52 53 54 64 public ActionErrors validate(ActionMapping mapping, 65 HttpServletRequest request) { 66 67 ActionErrors errors = new ActionErrors(); 68 if ((paintingTitle == null) || (paintingTitle.length() < 1)) 69 errors.add("paintingTitle", new ActionError("error.paintingtitle.required")); 70 71 return errors; 72 } 73 } | Popular Tags |