title: The request sent by the client was syntactically incorrect.-Spring MVC + JDBC Template
body: <p>I am newbie to Spring MVC.
  I was stuck by an error while running my project
  <strong>Error-The request sent by the client was syntactically incorrect.</strong>
  I have an entity class PatientInfo.
  My jsp page is demo1.
  My controller is Patient Controller.
  The functionality i want to implement is Inserting values into database.
  But i am not able to call my function(add-update2) in controller.</p>
  
  <p>demo1.jsp</p>
  
  <pre><code>        &lt;%@taglib prefix="form" uri="http://www.springframework.org/tags/form"%&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Registration Form&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;h2 align="center"&gt;Full Registration Form&lt;/h2&gt;
  &lt;hr /&gt;
  &lt;table align="center" cellpadding="5" cellspacing="5"&gt;
      &lt;form:form modelAttribute="patientInfo" method="POST" action="add-update2"&gt;
              &lt;tr&gt;
              &lt;td&gt; First Name&lt;/td&gt;
              &lt;td&gt;&lt;form:input path="firstName"/&gt;&lt;/td&gt;
          &lt;/tr&gt;
                 &lt;tr&gt;
              &lt;td&gt;Middle Name&lt;/td&gt;
              &lt;td&gt;&lt;form:input path="middleName" /&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Last Name&lt;/td&gt;
              &lt;td&gt;&lt;form:input path="lastName"/&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
                  &lt;tr&gt;
              &lt;td&gt;Age&lt;/td&gt;
              &lt;td&gt;&lt;form:input path="age" /&gt;&lt;/td&gt;
          &lt;/tr&gt;
                  &lt;tr&gt;
              &lt;td&gt;Gender&lt;/td&gt;
              &lt;td&gt;&lt;form:select path="gender"&gt;
                  &lt;form:option value="" label="Select Gender" /&gt;
                  &lt;form:options items="${genderList}" itemLabel="gender" itemValue="gender" /&gt;
              &lt;/form:select&gt;&lt;/td&gt;
          &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;Marital Status&lt;/td&gt;
                      &lt;td&gt;&lt;form:select path="maritalStatus"&gt;
                              &lt;form:option value="" label="Select Marital Status" /&gt;
                              &lt;form:options items="${maritalList}" itemLabel="maritalstatus" itemValue="maritalstatus" /&gt;
                          &lt;/form:select&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                    &lt;tr&gt;
              &lt;td&gt;Nationality&lt;/td&gt;
              &lt;td&gt;&lt;form:select path="nationality"&gt;
                  &lt;form:option value="" label="Select Nationality" /&gt;
                  &lt;form:options items="${nationalityList}" itemLabel="country" itemValue="country" /&gt;
              &lt;/form:select&gt;&lt;/td&gt;
          &lt;/tr&gt;
                   &lt;tr name="tstest"&gt;
                       &lt;td&gt;Date Of Birth&lt;/td&gt;
                       &lt;td&gt;&lt;form:input path="dateOfBirth" name="timestamp" value=""/&gt;
  &lt;a href="javascript:show_calendar('document.tstest.timestamp', document.tstest.timestamp.value);"&gt;&lt;img src="../images/cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the timestamp"&gt;&lt;/a&gt;
                       &lt;/td&gt;
                   &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td&gt;E-mail&lt;/td&gt;
      &lt;td&gt;&lt;form:input path="email"/&gt;&lt;/td&gt;
  &lt;/tr&gt;
              &lt;tr&gt;
              &lt;td&gt;Blood Group&lt;/td&gt;
              &lt;td&gt;&lt;form:select path="bloodGroup"&gt;
                  &lt;form:option value="" label="Select Blood Group" /&gt;
                  &lt;form:options items="${bloodList}" itemLabel="bloodgroupname"     itemValue="bloodgroupname" /&gt;
              &lt;/form:select&gt;&lt;/td&gt;
          &lt;/tr&gt;
                  &lt;tr&gt;
              &lt;td&gt;&lt;input type="submit"  value="submit"/&gt;&lt;/td&gt;
          &lt;/tr&gt;
  
      &lt;/form:form&gt;
  &lt;/table&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Controller-PatientController.java</p>
  
  <pre><code>package com.app.ehr.api;
  import com.app.ehr.domain.Bloodgroup;
  import com.app.ehr.domain.Gendertype;
  import com.app.ehr.entities.Patientinfo;
  import com.app.ehr.domain.Maritalstatus;
  import com.app.ehr.domain.Nationality;
  import com.app.ehr.model.Patient;
  import com.app.ehr.service.PatientService;
  
  import org.springframework.stereotype.Controller;
  
  import java.util.ArrayList;
  import java.util.List;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.ui.Model;
  import org.springframework.ui.ModelMap;
  import org.springframework.web.bind.annotation.ModelAttribute;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestMethod;
  
  @Controller
  public class PatientController {
  
     public PatientService patientService; 
  
     @Autowired
      public PatientController(PatientService patientService){
              this.patientService = patientService;
      }
  
       @RequestMapping(value="/", method= RequestMethod.GET)
      public String index(ModelMap map) {
  
          return "index";
      }
  
       @RequestMapping(value="/full-reg", method= RequestMethod.GET)
       public String fullreg(ModelMap map,Patientinfo patientInfo) {
  
          List&lt;Bloodgroup&gt; bloodList = new ArrayList&lt;Bloodgroup&gt;();
          List&lt;Gendertype&gt; genderList = new ArrayList&lt;Gendertype&gt;();
           List&lt;Nationality&gt; nationalityList = new ArrayList&lt;Nationality&gt;();
            List&lt;Maritalstatus&gt; maritalList = new ArrayList&lt;Maritalstatus&gt;();
  
          bloodList=patientService.getAllBloodgroup();
          genderList= patientService.getAllGendertype();
          nationalityList=patientService.getAllNationality();
          maritalList=patientService.getAllMaritalstatus();
  
          for(int i=0;i&lt;bloodList.size();i++)
          {
              System.out.println("---------------------Controller"+bloodList.get(i));
          }
         // map.addAttribute("hello", "Hello Spring from Netbeans!!");
           map.addAttribute("patientInfo", patientInfo);
          map.addAttribute("bloodList", patientService.getAllBloodgroup());
          map.addAttribute("genderList", patientService.getAllGendertype());
           map.addAttribute("maritalList", patientService.getAllMaritalstatus());
             map.addAttribute("nationalityList", patientService.getAllNationality());
          return "demo1";
      }
          @RequestMapping(value="/add-update2", method= RequestMethod.POST)
      public String addUpdate(@ModelAttribute("patientInfo") Patientinfo patientInfo) {
  System.out.println("----------------------------------------- From Controller------------------------------------------------");        
  //patientService.addPatient(patientInfo);
          return "redirect:/full-reg";
      }
  }
  </code></pre>
  
  <p>Entity Class- PatientInfo.java</p>
  
  <pre><code>package com.app.ehr.entities;
  
  import java.io.Serializable;
  import java.math.BigInteger;
  import java.util.Date;
  import javax.persistence.Basic;
  import javax.persistence.Column;
  import javax.persistence.Entity;
  import javax.persistence.Id;
  import javax.persistence.NamedQueries;
  import javax.persistence.NamedQuery;
  import javax.persistence.Table;
  import javax.persistence.Temporal;
  import javax.persistence.TemporalType;
  
  /**
   *
   * @author HP LAPTOP
   */
  @Entity
  @Table(name = "patientinfo")
  @NamedQueries({
      @NamedQuery(name = "Patientinfo.findAll", query = "SELECT p FROM Patientinfo p")})
  public class Patientinfo implements Serializable {
      private static final long serialVersionUID = 1L;
      @Id
      @Basic(optional = false)
      @Column(name = "PatientKey")
      private Long patientKey;
      @Column(name = "PatientMRNumber")
      private String patientMRNumber;
      @Column(name = "IntPrimaryPhysicianKey")
      private BigInteger intPrimaryPhysicianKey;
      @Column(name = "FirstName")
      private String firstName;
      @Column(name = "MiddleName")
      private String middleName;
      @Column(name = "LastName")
      private String lastName;
      @Column(name = "Age")
      private Short age;
      @Column(name = "Gender")
      private String gender;
      @Column(name = "Nationality")
      private String nationality;
      @Column(name = "DateOfBirth")
      @Temporal(TemporalType.TIMESTAMP)
      private Date dateOfBirth;
      @Column(name = "MaritalStatus")
      private String maritalStatus;
      @Column(name = "Occupation")
      private String occupation;
      @Column(name = "AnnualIncome")
      private String annualIncome;
      @Column(name = "BloodGroup")
      private String bloodGroup;
      @Column(name = "Email")
      private String email;
      @Column(name = "ModeOfPayment")
      private String modeOfPayment;
      @Column(name = "ModeOfPaymentAlt")
      private String modeOfPaymentAlt;
      @Column(name = "ExtPrimaryPhysicianName")
      private String extPrimaryPhysicianName;
      @Column(name = "ExtPrimaryPhysicianPhoneNumber")
      private String extPrimaryPhysicianPhoneNumber;
      @Column(name = "IsDeleted")
      private Boolean isDeleted;
      @Column(name = "Meta_CreatedByUser")
      private String metaCreatedByUser;
      @Column(name = "Meta_UpdatedDT")
      @Temporal(TemporalType.TIMESTAMP)
      private Date metaUpdatedDT;
      @Column(name = "Meta_CreatedDT")
      @Temporal(TemporalType.TIMESTAMP)
      private Date metaCreatedDT;
  
      public Patientinfo() {
      }
  
      public Patientinfo(Long patientKey) {
          this.patientKey = patientKey;
      }
  
      public Long getPatientKey() {
          return patientKey;
      }
  
      public void setPatientKey(Long patientKey) {
          this.patientKey = patientKey;
      }
  
      public String getPatientMRNumber() {
          return patientMRNumber;
      }
  
      public void setPatientMRNumber(String patientMRNumber) {
          this.patientMRNumber = patientMRNumber;
      }
  
      public BigInteger getIntPrimaryPhysicianKey() {
          return intPrimaryPhysicianKey;
      }
  
      public void setIntPrimaryPhysicianKey(BigInteger intPrimaryPhysicianKey) {
          this.intPrimaryPhysicianKey = intPrimaryPhysicianKey;
      }
  
      public String getFirstName() {
          return firstName;
      }
  
      public void setFirstName(String firstName) {
          this.firstName = firstName;
      }
  
      public String getMiddleName() {
          return middleName;
      }
  
      public void setMiddleName(String middleName) {
          this.middleName = middleName;
      }
  
      public String getLastName() {
          return lastName;
      }
  
      public void setLastName(String lastName) {
          this.lastName = lastName;
      }
  
      public Short getAge() {
          return age;
      }
  
      public void setAge(Short age) {
          this.age = age;
      }
  
      public String getGender() {
          return gender;
      }
  
      public void setGender(String gender) {
          this.gender = gender;
      }
  
      public String getNationality() {
          return nationality;
      }
  
      public void setNationality(String nationality) {
          this.nationality = nationality;
      }
  
      public Date getDateOfBirth() {
          return dateOfBirth;
      }
  
      public void setDateOfBirth(Date dateOfBirth) {
          this.dateOfBirth = dateOfBirth;
      }
  
      public String getMaritalStatus() {
          return maritalStatus;
      }
  
      public void setMaritalStatus(String maritalStatus) {
          this.maritalStatus = maritalStatus;
      }
  
      public String getOccupation() {
          return occupation;
      }
  
      public void setOccupation(String occupation) {
          this.occupation = occupation;
      }
  
      public String getAnnualIncome() {
          return annualIncome;
      }
  
      public void setAnnualIncome(String annualIncome) {
          this.annualIncome = annualIncome;
      }
  
      public String getBloodGroup() {
          return bloodGroup;
      }
  
      public void setBloodGroup(String bloodGroup) {
          this.bloodGroup = bloodGroup;
      }
  
      public String getEmail() {
          return email;
      }
  
      public void setEmail(String email) {
          this.email = email;
      }
  
      public String getModeOfPayment() {
          return modeOfPayment;
      }
  
      public void setModeOfPayment(String modeOfPayment) {
          this.modeOfPayment = modeOfPayment;
      }
  
      public String getModeOfPaymentAlt() {
          return modeOfPaymentAlt;
      }
  
      public void setModeOfPaymentAlt(String modeOfPaymentAlt) {
          this.modeOfPaymentAlt = modeOfPaymentAlt;
      }
  
      public String getExtPrimaryPhysicianName() {
          return extPrimaryPhysicianName;
      }
  
      public void setExtPrimaryPhysicianName(String extPrimaryPhysicianName) {
          this.extPrimaryPhysicianName = extPrimaryPhysicianName;
      }
  
      public String getExtPrimaryPhysicianPhoneNumber() {
          return extPrimaryPhysicianPhoneNumber;
      }
  
      public void setExtPrimaryPhysicianPhoneNumber(String extPrimaryPhysicianPhoneNumber) {
          this.extPrimaryPhysicianPhoneNumber = extPrimaryPhysicianPhoneNumber;
      }
  
      public Boolean getIsDeleted() {
          return isDeleted;
      }
  
      public void setIsDeleted(Boolean isDeleted) {
          this.isDeleted = isDeleted;
      }
  
      public String getMetaCreatedByUser() {
          return metaCreatedByUser;
      }
  
      public void setMetaCreatedByUser(String metaCreatedByUser) {
          this.metaCreatedByUser = metaCreatedByUser;
      }
  
      public Date getMetaUpdatedDT() {
          return metaUpdatedDT;
      }
  
      public void setMetaUpdatedDT(Date metaUpdatedDT) {
          this.metaUpdatedDT = metaUpdatedDT;
      }
  
      public Date getMetaCreatedDT() {
          return metaCreatedDT;
      }
  
      public void setMetaCreatedDT(Date metaCreatedDT) {
          this.metaCreatedDT = metaCreatedDT;
      }
  
      @Override
      public int hashCode() {
          int hash = 0;
          hash += (patientKey != null ? patientKey.hashCode() : 0);
          return hash;
      }
  
      @Override
      public boolean equals(Object object) {
          // TODO: Warning - this method won't work in the case the id fields are not set
          if (!(object instanceof Patientinfo)) {
              return false;
          }
          Patientinfo other = (Patientinfo) object;
          if ((this.patientKey == null &amp;&amp; other.patientKey != null) || (this.patientKey != null &amp;&amp; !this.patientKey.equals(other.patientKey))) {
              return false;
          }
          return true;
      }
  
      @Override
      public String toString() {
          return "com.app.ehr.entities.Patientinfo[ patientKey=" + patientKey + " ]";
      }
  
  }
  </code></pre>