title: Struts2 validations not working properly
body: <p>I'm new to struts2. I'm doing form validation using xml. But few of my feilds are getting invalidated everytime.</p>
  
  <p>The filds which are getting invalidated are: 
  police station, father's name, phone number and id number.</p>
  
  <p>My validation for phone number is showing two error messages. One that i have provided in my xml and other is <code>Invalid field value for field "phone".</code></p>
  
  <p>Further, for client side validation, if i add <code>validate=true"</code> to my <code>&lt;s:form&gt;</code> tag, following error appears just after my form in jsp</p>
  
  <pre><code>FreeMarker template error!
  
  
  Method public java.util.List org.apache.struts2.components.Form.getValidators(java.lang.String) threw an exception when invoked on org.apache.struts2.components.Form@17bb1c6
  The problematic instruction:
  ----------
  ==&gt; list tag.getValidators("${tagName}") as aValidator [on line 66, column 9 in template/~~~xhtml/form-close-validate.ftl]
   in include "/${parameters.templateDir}/${parameters.expandTheme}/form-close-validate.ftl" [on line 25, column 1 in template/xhtml/form-close.ftl]
  ----------
  
  Java backtrace for programmers:
  ----------
  freemarker.template.TemplateModelException: Method public java.util.List org.apache.struts2.components.Form.getValidators(java.lang.String) threw an exception when invoked on org.apache.struts2.components.Form@17bb1c6
      at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:130)
      at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:93)
      at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
      at freemarker.core.IteratorBlock.accept(IteratorBlock.java:94)
      at freemarker.core.Environment.visit(Environment.java:221)
      at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:167)
      at freemarker.core.Environment.visit(Environment.java:428)
      at freemarker.core.IteratorBlock.accept(IteratorBlock.java:102)
      at freemarker.core.Environment.visit(Environment.java:221)
      at freemarker.core.MixedContent.accept(MixedContent.java:92)
      at freemarker.core.Environment.visit(Environment.java:221)
      at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)
      at freemarker.core.Environment.visit(Environment.java:221)
      at freemarker.core.MixedContent.accept(MixedContent.java:92)
      at freemarker.core.Environment.visit(Environment.java:221)
      at freemarker.core.Environment.include(Environment.java:1508)
      at freemarker.core.Include.accept(Include.java:169)
      at freemarker.core.Environment.visit(Environment.java:221)
      at freemarker.core.MixedContent.accept(MixedContent.java:92)
      at freemarker.core.Environment.visit(Environment.java:221)
      at freemarker.core.Environment.process(Environment.java:199)
      at freemarker.template.Template.process(Template.java:259)
      at org.apache.struts2.components.template.FreemarkerTemplateEngine.renderTemplate(FreemarkerTemplateEngine.java:158)
      at org.apache.struts2.components.UIBean.mergeTemplate(UIBean.java:593)
      at org.apache.struts2.components.UIBean.end(UIBean.java:547)
      at org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42)
      at org.apache.jsp.register_002dcomplaint_jsp._jspx_meth_s_005fform_005f0(register_002dcomplaint_jsp.java:368)
      at org.apache.jsp.register_002dcomplaint_jsp._jspx_meth_s_005fdiv_005f0(register_002dcomplaint_jsp.java:233)
      at org.apache.jsp.register_002dcomplaint_jsp._jspService(register_002dcomplaint_jsp.java:166)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:403)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:347)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:301)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:96)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:136)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:74)
      at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:516)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1015)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:652)
      at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1575)
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1533)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:744)
  Caused by: java.lang.NullPointerException
      at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.buildValidatorKey(AnnotationActionValidatorMana
  </code></pre>
  
  <p>and following error appears on my console</p>
  
  <pre><code>SEVERE [http-nio-8084-exec-129] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [jsp] in context with path [/FIR_System] threw exception [Method public java.util.List org.apache.struts2.components.Form.getValidators(java.lang.String) threw an exception when invoked on org.apache.struts2.components.Form@17bb1c6 - Class: freemarker.ext.beans.SimpleMethodModel
  File: SimpleMethodModel.java
  Method: exec
  Line: 130 - freemarker/ext/beans/SimpleMethodModel.java:130:-1] with root cause
   java.lang.NullPointerException
      at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.buildValidatorKey(AnnotationActionValidatorManager.java:237)
      at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.getValidators(AnnotationActionValidatorManager.java:94)
      at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.getValidators(AnnotationActionValidatorManager.java:90)
      at org.apache.struts2.components.Form.getValidators(Form.java:280)
      at sun.reflect.GeneratedMethodAccessor321.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:483)
      at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:866)
      at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:106)
      at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:93)
      at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
      at freemarker.core.IteratorBlock.accept(IteratorBlock.java:94)
      at freemarker.core.Environment.visit(Environment.java:221)
      at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:167)
      at freemarker.core.Environment.visit(Environment.java:428)
      at freemarker.core.IteratorBlock.accept(IteratorBlock.java:102)
      at freemarker.core.Environment.visit(Environment.java:221)
      at freemarker.core.MixedContent.accept(MixedContent.java:92)
      at freemarker.core.Environment.visit(Environment.java:221)
      at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)
      at freemarker.core.Environment.visit(Environment.java:221)
      at freemarker.core.MixedContent.accept(MixedContent.java:92)
      at freemarker.core.Environment.visit(Environment.java:221)
      at freemarker.core.Environment.include(Environment.java:1508)
      at freemarker.core.Include.accept(Include.java:169)
      at freemarker.core.Environment.visit(Environment.java:221)
      at freemarker.core.MixedContent.accept(MixedContent.java:92)
      at freemarker.core.Environment.visit(Environment.java:221)
      at freemarker.core.Environment.process(Environment.java:199)
      at freemarker.template.Template.process(Template.java:259)
      at org.apache.struts2.components.template.FreemarkerTemplateEngine.renderTemplate(FreemarkerTemplateEngine.java:158)
      at org.apache.struts2.components.UIBean.mergeTemplate(UIBean.java:593)
      at org.apache.struts2.components.UIBean.end(UIBean.java:547)
      at org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42)
      at org.apache.jsp.register_002dcomplaint_jsp._jspx_meth_s_005fform_005f0(register_002dcomplaint_jsp.java:368)
      at org.apache.jsp.register_002dcomplaint_jsp._jspx_meth_s_005fdiv_005f0(register_002dcomplaint_jsp.java:233)
      at org.apache.jsp.register_002dcomplaint_jsp._jspService(register_002dcomplaint_jsp.java:166)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:403)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:347)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:301)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:96)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:136)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:74)
      at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:516)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1015)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:652)
      at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1575)
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1533)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:744)
  </code></pre>
  
  <p>Please help me resolving these problems. I'm using <strong>Struts 2.3.16</strong> libraries.</p>
  
  <p><strong>Update</strong> Validations are <strong>NOT</strong> working when i leave some feilds blank. Exception part is still unresolved when <code>validate="true"</code> is ON in the struts form tag. Here's the updated code.</p>
  
  <p>** Updated jsp form**</p>
  
  <pre><code>&lt;s:form name="register-complaint" action="registerComplaint validate=""true" method="post"&gt;
      &lt;s:textfield name="policeStation" label="Nearest Police Station"/&gt;
      &lt;s:select name="district" label="District" 
          list="{'Central Delhi','East Delhi','New Delhi','North Delhi','North-East Delhi','North-West Delhi', 'South Delhi','Soth West Delhi', 'West Delhi'}" /&gt;
      &lt;s:textfield name="name" label="Your name"/&gt;
      &lt;s:textfield name="fathersName" label="Father's Name"/&gt;
      &lt;s:textarea name="address" label="Your Address"/&gt;
      &lt;s:textfield name="phone" label="Phone Number"/&gt;
      &lt;s:textfield name="email" label="Email address"/&gt;
      &lt;s:select name="idProof" label="ID Proof"
          list="{'Aadhar Card', 'Driving License','PAN Card', 'Passport', 'Electoral Card'}"/&gt;
      &lt;s:textfield name="idNumber" label="ID Number"/&gt;
      &lt;s:textfield name="distance" label="Distance from nearest police station"/&gt;
      &lt;s:select name="direction" label="Direction from nearest Police Station"
          list="{'East', 'North', 'North-East', 'North-west', 'South', 'South-east', 'South-west', 'West' }"/&gt;
      &lt;sj:datepicker name="dateAndTimeOfOccurance" label="Date and Time of Offence" timepicker="true" timepickerAaPm="true" timepickerGridHour="1" timepickerGridMinute="5" timepickerStepMinute="5"/&gt;
      &lt;s:textfield name="offence" label="Offence"/&gt;
      &lt;s:textfield name="section" label="section"/&gt;
      &lt;s:textarea name="particulars" label="Particulars of the offence"/&gt;
      &lt;s:textarea name="descriptionOfAccused" label="Description of accused"/&gt;
      &lt;s:textarea name="witness" label="Witnesses (with address)" /&gt;
      &lt;s:textarea name="compaint" label="Detailed complaint" /&gt;
      &lt;s:submit name="submit" label="Submit" align="center" /&gt;
  &lt;/s:form&gt;
  </code></pre>
  
  <p>** Updated Validation file**</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE validators PUBLIC
           "-//Apache Struts//XWork Validator 1.0.3//EN"
             "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"&gt;
  &lt;validators&gt;
      &lt;field name="policeStation"&gt;
          &lt;field-validator type="requiredstring"&gt;
              &lt;message&gt;
                  Police Station Required.
              &lt;/message&gt;
          &lt;/field-validator&gt;
      &lt;/field&gt;
      &lt;field name="name"&gt;
          &lt;field-validator type="requiredstring"&gt;
              &lt;message&gt;
                  Your name is required.
              &lt;/message&gt;
          &lt;/field-validator&gt;
      &lt;/field&gt;
      &lt;field name="fathersName"&gt;
          &lt;field-validator type="requiredstring"&gt;
              &lt;message&gt;
                  Father's name required.
              &lt;/message&gt;
          &lt;/field-validator&gt;
      &lt;/field&gt;
  
      &lt;field name="address"&gt;
          &lt;field-validator type="requiredstring"&gt;
              &lt;message&gt;
                  Your address required.
              &lt;/message&gt;
          &lt;/field-validator&gt;
      &lt;/field&gt;
  
      &lt;field name="phone"&gt;
          &lt;field-validator type="requiredInt"&gt;
              &lt;message&gt;
                  Valid Phone number required.
              &lt;/message&gt;
          &lt;/field-validator&gt;
      &lt;/field&gt;
  
      &lt;field name="email"&gt;
          &lt;field-validator type="email"&gt;
              &lt;message&gt;
                  Enter a valid email id.
              &lt;/message&gt;
          &lt;/field-validator&gt;
      &lt;/field&gt;
  
      &lt;field name="idNumber"&gt;
          &lt;field-validator type="requiredstring"&gt;
              &lt;message&gt;
                  Your ID proof number is required.
              &lt;/message&gt;
          &lt;/field-validator&gt;
      &lt;/field&gt;
  
      &lt;field name="distance"&gt;
          &lt;field-validator type="double"&gt;
              &lt;message&gt;
                  Please enter the distance from police station.
              &lt;/message&gt;
          &lt;/field-validator&gt;
      &lt;/field&gt;
  
      &lt;field name="dateAndTimeOfOccurance"&gt;
          &lt;field-validator type="date"&gt;
              &lt;message&gt;
                  Please enter the date and time of incident.
              &lt;/message&gt;
          &lt;/field-validator&gt;
      &lt;/field&gt;
  
      &lt;field name="offence"&gt;
          &lt;field-validator type="requiredstring"&gt;
              &lt;message&gt;
                  Enter the offence.
              &lt;/message&gt;
          &lt;/field-validator&gt;
      &lt;/field&gt;
  
      &lt;field name="particulars"&gt;
          &lt;field-validator type="requiredstring"&gt;
              &lt;message&gt;
                  Provide the details lost/damaged life/property.
              &lt;/message&gt;
          &lt;/field-validator&gt;
      &lt;/field&gt;
  
      &lt;field name="complaint"&gt;
          &lt;field-validator type="requiredstring"&gt;
              &lt;message&gt;
                  Describe your complaint in detail.
              &lt;/message&gt;
          &lt;/field-validator&gt;
      &lt;/field&gt;
  &lt;/validators&gt;
  </code></pre>
  
  <p><strong>Action class</strong></p>
  
  <pre><code>public class RegisterComplaintAction extends ActionSupport implements SessionAware, ServletContextAware {
  
      private int id;
      private int userId;
      private String policeStation;
      private String district;
      private String name;
      private String fathersName;
      private String address;
      private int phone;
      private String email;
      private String idProof;
      private String idNumber;
      private float distance;
      private String directionFromPoliceStation;
      private Date dateAndTimeOfOccurance;
      private String offence;
      private String section;
      private String particulars;
      private String descriptionOfAccused;
      private String witness;
      private String complaints;
  
      private Map session;
      private ServletContext context;
  
      @Override
      public void setSession(Map session) {
          this.session = session;
      }
  
      @Override
      public void setServletContext(ServletContext sc) {
          this.context = sc;
      }
  
      /**
       *
       * @return @throws Exception
       */
      @Override
      public String execute() throws Exception {
  
          Connection con = null;
          PreparedStatement ps = null;
          try {
              System.out.println(getDateAndTimeOfOccurance());
              Class.forName(context.getInitParameter("db-driver-class"));
              con = DriverManager.getConnection(context.getInitParameter("db-url"), context.getInitParameter("db-user"), context.getInitParameter("db-password"));
              ps = con.prepareStatement("INSERT INTO FIR.COMPLAINTS (USERNAME, POLICE_STATION, DISTRICT, NAME, FATHER_NAME, ADDRESS, PHONE, EMAIL, ID_PROOF, ID_NUMBER, DISTANCE_FROM_POLICE_STATION, DIRECTION_FROM_POLICE_STATION, DATE_AND_TIME_OF_OCCURANCE, OFFENCE, SEC, PARTICULARS, DESCRIPTION_OF_ACCUSED, WITNESS, COMPLAINTS) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
              ps.setString(1, (String) session.get("username"));
              ps.setString(2, getPoliceStation());
              ps.setString(3, getDistrict());
              ps.setString(4, getName());
              ps.setString(5, getFathersName());
              ps.setString(6, getAddress());
              ps.setInt(7, getPhone());
              ps.setString(8, getEmail());
              ps.setString(9, getIdProof());
              ps.setString(10, getIdNumber());
              ps.setFloat(11, getDistance());
              ps.setString(12, getDirectionFromPoliceStation());
              ps.setTimestamp(13, new java.sql.Timestamp(getDateAndTimeOfOccurance().getTime()));
              ps.setString(14, getOffence());
              ps.setString(15, getSection());
              ps.setString(16, getParticulars());
              ps.setString(17, getDescriptionOfAccused());
              ps.setString(18, getWitness());
              ps.setString(19, getComplaints());
              if (ps.executeUpdate() != 0) {
                  session.put("successMessage", "Your Complaint has been successfully registered");
              }
          } catch (Exception e) {
              session.put("errorMessage", "Unable to register your complaint " + e + getDateAndTimeOfOccurance());
              return ERROR;
          } finally {
              ps.close();
              con.close();
          }
          return SUCCESS;
      }
  
      public int getId() {
          return id;
      }
  
      public void setId(int id) {
          this.id = id;
      }
  
      public int getUserId() {
          return userId;
      }
  
      public void setUserId(int userId) {
          this.userId = userId;
      }
  
      public String getPoliceStation() {
          return policeStation;
      }
  
      public void setPoliceStation(String policeStation) {
          this.policeStation = policeStation;
      }
  
      public String getDistrict() {
          return district;
      }
  
      public void setDistrict(String district) {
          this.district = district;
      }
  
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      public String getFathersName() {
          return fathersName;
      }
  
      public void setFathersName(String fathersName) {
          this.fathersName = fathersName;
      }
  
      public String getAddress() {
          return address;
      }
  
      public void setAddress(String address) {
          this.address = address;
      }
  
      public int getPhone() {
          return phone;
      }
  
      public void setPhone(int phone) {
          this.phone = phone;
      }
  
      public String getEmail() {
          return email;
      }
  
      public void setEmail(String email) {
          this.email = email;
      }
  
      public String getIdProof() {
          return idProof;
      }
  
      public void setIdProof(String idProof) {
          this.idProof = idProof;
      }
  
      public String getIdNumber() {
          return idNumber;
      }
  
      public void setIdNumber(String idNumber) {
          this.idNumber = idNumber;
      }
  
      public float getDistance() {
          return distance;
      }
  
      public void setDistance(float distance) {
          this.distance = distance;
      }
  
      public String getDirectionFromPoliceStation() {
          return directionFromPoliceStation;
      }
  
      public void setDirectionFromPoliceStation(String directionFromPoliceStation) {
          this.directionFromPoliceStation = directionFromPoliceStation;
      }
  
      public Date getDateAndTimeOfOccurance() {
          return dateAndTimeOfOccurance;
      }
  
      public void setDateAndTimeOfOccurance(Date dateAndTimeOfOccurance) {
          System.out.println(dateAndTimeOfOccurance);
          this.dateAndTimeOfOccurance = dateAndTimeOfOccurance;
      }
  
      public String getOffence() {
          return offence;
      }
  
      public void setOffence(String offence) {
          this.offence = offence;
      }
  
      public String getSection() {
          return section;
      }
  
      public void setSection(String section) {
          this.section = section;
      }
  
      public String getParticulars() {
          return particulars;
      }
  
      public void setParticulars(String particulars) {
          this.particulars = particulars;
      }
  
      public String getDescriptionOfAccused() {
          return descriptionOfAccused;
      }
  
      public void setDescriptionOfAccused(String descriptionOfAccused) {
          this.descriptionOfAccused = descriptionOfAccused;
      }
  
      public String getWitness() {
          return witness;
      }
  
      public void setWitness(String witness) {
          this.witness = witness;
      }
  
      public String getComplaints() {
          return complaints;
      }
  
      public void setComplaints(String complaints) {
          this.complaints = complaints;
      }
  
  }
  </code></pre>
  
  <p>PS: I waas forced to remove previous code from this post because of maximum character limit :(</p>