title: How to assign a value of an input to an object that comes from controller class?
body: <p>I'm new to full stack programming and developing a training project. Before that I was using jsp and it was easy to handle these type of things in there, but nowadays working on ftl. I'm trying to send an object to template and want to fill this object's fields with values from template. However template returns null or gives an error in each attempt.
  What is my fault, or is it possible to do this in ftl? Thank you from now.</p>
  
  <p>This is my Get method, sending DatabaseUser object to template,</p>
  
  <pre><code>@RequestMapping(value="/createRequest.html", method= RequestMethod.GET)
  public ModelAndView add() throws ServiceException {
      DatabaseUser dbUser = new DatabaseUser();
      ModelAndView mav = new ModelAndView("index");
      mav.addObject("user", dbUser);
      return mav;
  }
  </code></pre>
  
  <p>and this one is post method, trying to get form values of template and assign them to object's fields.</p>
  
  <p>I just want to get string from form input, assign it to dbUser object's address field and send this object to save() method.</p>
  
  <pre><code>@RequestMapping(value="/saveRequest.html", method=RequestMethod.POST)
  public ModelAndView save(@ModelAttribute("user") DatabaseUser dbUser,
                           BindingResult bindingResult) throws ServiceException{
      if(bindingResult.hasErrors()){
          LOGGER.debug("Binding error count: " + bindingResult.getErrorCount());
      }
      if(dbUser.getBaseUser.getUserId()==0){
          BaseUser baseUser = new BaseUser();
          baseUser.setAddres(dbUser.getBaseUser().getAddress());
          baseUser.setEmail(dbUser.getBaseUser().getEmail());
      }
      return add();
  </code></pre>
  
  <p>and the part of my ftl file that trying to satisfy this situation:</p>
  
  <pre><code>&lt;div class="row"&gt;
      &lt;div class="col-sm-12 col-lg-6"&gt;
          &lt;form action="&lt;@spring.url '/saveRequest.html' /&gt;"
               modelAttribute="user" method="post" id="form3"&gt;
               &lt;input type="hidden" name="user" value="user"/&gt;
  &lt;div class="form-group"&gt;
      &lt;label for="address"&gt;&lt;@spring.message "translationrequest.documentNumber" /&gt;&lt;/label&gt;
      &lt;input type="text" id="address" name="address" class="form-control"
            maxlength="250" value="${(getBaseuser().setAddress())!}"/&gt;
  &lt;/div&gt;
  </code></pre>