title: Convert Thymeleaf "th:field" in Freemarker
body: <p>I convert my project from Thymeleaf to Freemaker. I have one problem. Now I’ll try to describe it.</p>
  
  <p>On the main page of my site there are list of vendors and a search field that searches for vendors by name.</p>
  
  <p>In Thymeleaf it looks something like this-</p>
  
  <p><strong>Controller:</strong></p>
  
  <pre><code> @GetMapping("/vendors")
  public String getAllVendors(Model model,@PageableDefault Pageable pageable){
      Page&lt;Vendors&gt; vendors = vendorRepository.findAll(pageable);
      model.addAttribute("searchVendor",new Foo()); //This is for search field
      model.addAttribute("url","/vendors");
      model.addAttribute("vendors",vendors);
  
      return "vendors/list";
  }
  </code></pre>
  
  <p>Foo class:</p>
  
  <pre><code>@Getter
  @Setter
  public class Foo {
      private List&lt;Long&gt; checkedItems; // for checkboxes
      private List&lt;Long&gt; checkedItemsPlus; //for checkboxes
      private String findItem; // to find by the name
      private Long findSupply; // to find by the id
      private String findItemPlus; // to find by the second name
  }
  </code></pre>
  
  <p><strong>Thymeleaf template (form for search field):</strong></p>
  
  <pre><code> &lt;form th:action="@{/showVendor}" method="post" class="form-inline"&gt;
      &lt;input type="search" class="form-control mr-sm-2" 
        th:field="${searchVendor.findItem}" placeholder="Search By Name"/&gt;
        &lt;button type="submit" class="btn btn-outline-success"&gt;
           Search
        &lt;/button&gt;
    &lt;/form&gt;
  </code></pre>
  
  <blockquote>
    <p>${searchVendor.findItem}-this is the string in which the entered name
    is written.</p>
  </blockquote>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>@PostMapping("/showVendor")
  public String getVendorBySearch(Model model,@ModelAttribute("searchVendor") Foo foo){
  
  model.addAttribute("vendors",
        vendorService.getVendorByName(foo.getFindItem()));
  
  return "vendors/show";
  </code></pre>
  
  <p>}</p>
  
  <p>Thats all works fine with Thymeleaf.</p>
  
  <p>In Freemaker i changed only my thymeleaf template -</p>
  
  <p><strong>Freemaker template</strong></p>
  
  <pre><code> &lt;form action="/showVendor" method="post" class="form-inline"&gt;
       &lt;input type="search" class="form-control mr-sm-2" value="${searchVendor.findItem}" id="findItem" name="findItem" placeholder="Search By Name"/&gt;
        &lt;button type="submit" class="btn btn-outline-success my-2 my-sm-0"&gt;Search&lt;/button&gt;
   &lt;/form&gt;
  </code></pre>
  
  <blockquote>
    <p>I'm not sure about that, but replaced <strong>th:field</strong> on <strong>value, id, name</strong></p>
    
    <p>Then i click button i have this error-</p>
  </blockquote>
  
  <pre><code>Whitelabel Error Page
  This application has no explicit mapping for /error, so you are seeing this as a fallback.
  
  Wed Nov 07 21:42:23 MSK 2018
  There was an unexpected error (type=Forbidden, status=403).
  Forbidden
  </code></pre>
  
  <blockquote>
    <p><strong>And my final questions.How to replace th:field from Thymeleaf to
    Freemaker? Did I do it right or i need to do something else? Why does this error come?</strong></p>
  </blockquote>