title: How to add default values to input fields in Thymeleaf
body: <p>I am programming in Spring and using Thymeleaf as my view, and am trying to create a form where users can update their profile. I have a profile page which lists the user's information (first name, last name, address, etc), and there is a link which says "edit profile". When that link is clicked it takes them to a form where they can edit their profile. The form consists of text fields that they can input, just like your standard registration form. </p>
  
  <p>Everything works fine, but my question is, when that link is clicked, how do I add the user's information to the input fields so that it is already present, and that they only modify what they want to change instead of having to re-enter all the fields. </p>
  
  <p>This should behave just like a standard "edit profile" page. </p>
  
  <p>Here is a segment of my edit_profile.html page:</p>
  
  <p>First Name: </p>
  
  <p>Here is the view controller method that returns edit_profile.html page:</p>
  
  <pre><code>@RequestMapping(value = "/edit", method = RequestMethod.GET)
      public String getEditProfilePage(Model model) {
          model.addAttribute("currentUser", currentUser);
          System.out.println("current user firstname: " + currentUser.getFirstname());
          model.addAttribute("user", new User());
          return "edit_profile";
      }
  </code></pre>
  
  <p>currentUser.getFirstname() prints out the expected value, but I'm getting blank input values in the form.</p>
  
  <p>Thanks. </p>