title: Failed to convert value of type 'java.lang.String' to required type 'int';
body: <p>passing id value to controller gives an error " Failed to convert the value of type 'java.lang.String' to required type 'int'".</p>
  
  <p>but when I print System.out.println(studentService.findById(id)) it give a output in terminal as
  Optional[Student{id=1, firstName='Abhishek', lastName='Shukla', branch='CS', year=4, mobileNumber='9876543210'}]</p>
  
  <p>I already tried to pass the id as a string and convert string to int by using Integr.parseInt(id)  in the controller but it throws an error as 
   " Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NumberFormatException: For input string: "{id}"] with root cause "</p>
  
  <pre><code>
      &lt;h1&gt;Student Place&lt;/h1&gt;
      &lt;form name="myForm" action="/student/{id}" &gt;
          &lt;table border="1"&gt;
              &lt;tbody&gt;
                  &lt;tr&gt;
                      &lt;td&gt;Student ID :&lt;/td&gt;
                      &lt;td&gt;&lt;input type="text" name="id" size="10" /&gt; &lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/tbody&gt;
           &lt;/table&gt;
           &lt;br&gt;
          &lt;input type="submit" value="submit" name="submit" /&gt;&lt;br&gt;
          &lt;input type="reset" value="Rest" name="reset" /&gt;
       &lt;/form&gt;
  
  </code></pre>
  
  <pre><code>
  @Controller
  public class StudentController {
  
      @Autowired
      private StudentService studentService  ;
  
      @GetMapping(value = "/students")
      public  String index(ModelMap modelMap){
          modelMap.put("students" , studentService.findAll());
          return "index" ;
      }
  
      @GetMapping(value = "/student/{id}")
      public String data(@PathVariable("id") int id , ModelMap modelMap){
          modelMap.put("students" , studentService.findById(id)) ;
          System.out.println(studentService.findById(id));
  
          return "studentbyid" ;
      }
  
      @GetMapping(value = "/student")
      public String databyid(){
          return "student" ;
      }
  }
  
  
  </code></pre>
  
  <pre><code>
  public interface StudentService {
  
      public Iterable&lt;Student&gt; findAll() ;
      public Optional&lt;Student&gt; findById(int id) ;
  }
  
  </code></pre>
  
  <pre><code>
  @Transactional
  @Service("studentService")
  public class StudentServiceImpl implements StudentService {
  
      @Autowired
      private StudentRepository studentRepository ;
  
      @Override
      public Iterable&lt;Student&gt; findAll() {
          return studentRepository.findAll();
      }
  
      public Optional&lt;Student&gt; findById(int id) {
          return studentRepository.findById(id);
      }
  }
  
  </code></pre>
  
  <pre><code>
  @Entity
  @Table(name = "student")
  public class Student {
  
      @Id
      @Column(name="id")
      private int id ;
  
      @Column(name="first_name")
      private String firstName ;
  
      @Column(name="last_name")
      private String lastName ;
  
      @Column(name="branch")
      private String branch ;
  
      @Column(name="year")
      private int  year ;
  
      @Column(name="mobile_number")
      private String mobileNumber ;
  
      public Student() {
      }
  
      public Student(int id, String firstName, String lastName, String branch, int year, String mobileNumber) {
          this.id = id;
          this.firstName = firstName;
          this.lastName = lastName;
          this.branch = branch;
          this.year = year;
          this.mobileNumber = mobileNumber;
      }
  
      public int getId() {
          return id;
      }
  
      public void setId(int id) {
          this.id = id;
      }
  
      public String getFirstName() {
          return firstName;
      }
  
      public void setFirstName(String firstName) {
          this.firstName = firstName;
      }
  
      public String getLastName() {
          return lastName;
      }
  
      public void setLastName(String lastName) {
          this.lastName = lastName;
      }
  
      public String getBranch() {
          return branch;
      }
  
      public void setBranch(String branch) {
          this.branch = branch;
      }
  
      public int getYear() {
          return year;
      }
  
      public void setYear(int year) {
          this.year = year;
      }
  
      public String getMobileNumber() {
          return mobileNumber;
      }
  
      public void setMobileNumber(String mobileNumber) {
          this.mobileNumber = mobileNumber;
      }
  
      @Override
      public String toString() {
          return "Student{" +
                  "id=" + id +
                  ", firstName='" + firstName + '\'' +
                  ", lastName='" + lastName + '\'' +
                  ", branch='" + branch + '\'' +
                  ", year=" + year +
                  ", mobileNumber='" + mobileNumber + '\'' +
                  '}';
      }
  }
  
  </code></pre>
  
  <p>Whitelabel Error Page
  This application has no explicit mapping for /error, so you are seeing this as a fallback.</p>
  
  <p>There was an unexpected error (type=Bad Request, status=400).
  Failed to convert value of type 'java.lang.String' to required type 'int'; nested exception is java.lang.NumberFormatException: For input string: "{id}"</p>