title: Calling Java Method/Variable in HTML - Thymeleaf Spring Boot
body: <p>I want to call an Java Object method in my HTML File, but I don't know how to do that. I think my <code>th:text</code> in my HTML could be the problem, but couldn't find a better solution.</p>
  
  <p>My HTML:</p>
  
  <pre><code>&lt;!DOCTYPE HTML&gt;
  &lt;html xmlns:th="http://www.thymeleaf.org"&gt;
  &lt;head&gt;
      &lt;title&gt;Create User&lt;/title&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;h1&gt;Form&lt;/h1&gt;
      &lt;p&gt;First Name: &lt;input type="text" th:object="${ov}" th:text="${T(com.example.servingwebcontent.Overview).getGear()}" /&gt;&lt;/p&gt;
  
  
  &lt;/body&gt;
  &lt;/html&gt;
  
  </code></pre>
  
  <p>My Java Object:</p>
  
  <pre><code>package com.example.servingwebcontent;
  
  public class Overview {
  
      String gear;
  
      public void setGear(String gear) {
          this.gear = gear;
      }
  
      public String getGear() {
          return gear;
      }
  
  
  }
  
  </code></pre>
  
  <p>And my Java Controller:</p>
  
  <pre><code>  public String handle=null;
      @RequestMapping("/overview")
      public String overview(@RequestParam(name="name", required=false) String name,@RequestParam String testOrder, Model model){
          handle=testOrder;
          model.addAttribute("ov", testOrder);
          return "overview";
      }
  
  </code></pre>