title: Spring, Thymleaf and lists of strings
body: <p>Okay, I a wet-behind-the-ears newcomer to Spring and Thymleaf. I'm trying to do something so simple it should be a no-brainer. But I can't get it to work. The simple question is - how do you show a list of strings in an web page?</p>
  
  <p>I have the following model</p>
  
  <pre><code>import java.util.List;
  public class TestModel {
  
      private List&lt;String&gt; list = null;
      private String content;
  
      public String getContent() {
          return content;
      }
  
      public void setContent(String content) {
          this.content = content;
      }
  
      public List&lt;String&gt; getList() { return list; }
  
      public void setList(final List&lt;String&gt; list) {
          this.list = list;
      }
  }
  </code></pre>
  
  <p>My web page contains the following:</p>
  
  <pre><code>&lt;div th:if="${greeting.list != null}"&gt;
      &lt;h1&gt;Result&lt;/h1&gt;
      &lt;ul&gt;
      &lt;th:block th:object="${greeting}" th:each="item : ${list}"&gt;
       &lt;li th:text="${item.name}"&gt;Item description here...&lt;/li&gt;
      &lt;/th:block&gt;
      &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I added the ".name" to "item" only because I found a couple of examples where they had a list of strings and did something similar. But they had the ".name" on the object.</p>
  
  <p>But it still doesn't work. The unordered list ends up empty. I.e. There isn't any list items inside the unordered tags.</p>
  
  <p>What <em>am</em> I doing wrong? Pointers gladly accepted.</p>