title: Spring MVC: path variable {studentId} not displaying correctly
body: <p>This really confuses me. 
  Instead of proper URL with the value of one path variable <code>{studentId}</code>:
  "<a href="http://somedomain.com:8080/someWebApp/essays/main/student/25/activity/add" rel="nofollow">http://somedomain.com:8080/someWebApp/essays/main/student/25/activity/add</a>" (where 25 is the value of path variable <code>{studentId}</code>)
  I get this in my URL: 
  "<a href="http://somedomain.com:8080/someWebApp/essays/main/student/%7BstudentId%7D/activity/add" rel="nofollow">http://somedomain.com:8080/someWebApp/essays/main/student/%7BstudentId%7D/activity/add</a>"</p>
  
  <p>This is my controller method for displaying some testPage and it works fine:</p>
  
  <pre><code>@RequestMapping(value="/{studentId}/activity/add", method = RequestMethod.GET)
      public String getForm(@PathVariable Integer studentId, Model model) {
  
          StudentActivityDTO studentActivityDTO = new StudentActivityDTO();
          Student student = studentService.get(studentId);
          studentActivityDTO.setStudent(student);
          studentActivityDTO.getActivity().setEssayFlag("Essay");
          model.addAttribute("studentActivityDTO", studentActivityDTO);
          model.addAttribute("courseList", courseService.getAll());
          model.addAttribute("teacherList", teacherService.getAll());
  
          return "testPage";
      }
  </code></pre>
  
  <p>And this is post controller method where this problem happens:</p>
  
  <pre><code>@RequestMapping(value="/{studentId}/activity/add", method = RequestMethod.POST)
      public String postForm(@ModelAttribute("studentActivityDTO") StudentActivityDTO studentActivityDTO,
                              @PathVariable Integer studentId,
                              Model model) {
  
          logger.debug("Received request to add new activity to student");
  
          Activity activity = studentActivityDTO.getActivity();
          activityService.add(studentId, activity);
  
          return "success/addActivitySuccess";
      }
  </code></pre>
  
  <p>In the first case <code>@PathVariable</code> works fine, in the second case it gives this error:</p>
  
  <pre><code>Failed to convert value of type 'java.lang.String' to required type 'java.lang.Integer'; nested exception is java.lang.NumberFormatException: For input string: "{studentId}"
  </code></pre>
  
  <p>Instead of some value of the <code>{studentId}</code> being in the URL, I get string "{studentId}". </p>
  
  <p>Can someone please tell me why?</p>
  
  <p><strong>Update</strong>: This is the important part of the jsp page (it is a pretty big page):</p>
  
  <pre><code>&lt;c:url var="studentUrl" value="/essays/main/student/{studentId}/activity/add" /&gt;
  &lt;form:form modelAttribute="studentActivityDTO" method="POST" action="${studentUrl}"&gt;
  ...
  &lt;input type="submit" value="Submit" /&gt;
  &lt;/form:form&gt;
  </code></pre>