| 1 6 7 package com.quikj.application.communicator.applications.webtalk.controller; 8 9 import javax.servlet.http.HttpServletRequest ; 10 import org.apache.struts.action.ActionError; 11 import org.apache.struts.action.ActionErrors; 12 import org.apache.struts.action.ActionForm; 13 import org.apache.struts.action.ActionMapping; 14 import java.text.SimpleDateFormat ; 15 import com.quikj.application.communicator.applications.webtalk.model.*; 16 20 public class UserReportForm extends ActionForm 21 { 22 23 private String startDate; 24 private String endDate; 25 private String orderBy = "name"; 26 27 28 public UserReportForm() 29 { 30 java.util.Date today = new java.util.Date (); 31 SimpleDateFormat formatter = new SimpleDateFormat ("MM/dd/yyyy"); 32 endDate = formatter.format(today); 33 startDate = formatter.format(today); 34 } 35 public void reset(ActionMapping mapping, HttpServletRequest request) 36 { 37 38 java.util.Date today = new java.util.Date (); 39 SimpleDateFormat formatter = new SimpleDateFormat ("MM/dd/yyyy"); 40 endDate = formatter.format(today); 41 startDate = formatter.format(today); 43 this.orderBy = "name"; 44 } 45 46 50 public java.lang.String getEndDate() 51 { 52 return endDate; 53 54 } 55 56 60 public void setEndDate(java.lang.String endDate) 61 { 62 this.endDate = endDate; 63 } 64 65 69 public java.lang.String getStartDate() 70 { 71 return startDate; 72 } 73 74 78 public void setStartDate(java.lang.String startDate) 79 { 80 this.startDate = startDate; 81 } 82 86 public java.lang.String getOrderBy() 87 { 88 return orderBy; 89 } 90 91 95 public void setOrderBy(java.lang.String orderBy) 96 { 97 this.orderBy = orderBy; 98 } 99 100 public ActionErrors validate(ActionMapping mapping, 101 HttpServletRequest request) 102 { 103 ActionErrors errors = new ActionErrors(); 104 105 java.sql.Date sd = TrafficDataBean.convertDate(startDate); 106 if (sd == null) 107 { 108 errors.add("startDate", new ActionError("error.Date.format")); 109 } 110 111 java.sql.Date ed = TrafficDataBean.convertDate(endDate); 112 if (sd == null) 113 { 114 errors.add("endDate", new ActionError("error.Date.format")); 115 } 116 117 return errors; 118 119 } 120 } 121 | Popular Tags |