title: Thymeleaf Loop Until a Number
body: <p>I make a search and get response from server with Thymeleaf. This holds the number of results:</p>
  
  <pre><code>${response.count}
  </code></pre>
  
  <p>I want to make an iteration like that:</p>
  
  <pre><code>for (int i = 1; i &lt;= response.count; i++) {
      if (response.page == i) {
          &lt;button class="active"&gt;Dummy&lt;/button&gt;
      } else {
          &lt;button&gt;Dummy&lt;/button&gt;
      }
  }
  </code></pre>
  
  <p>How can I do that? I've tried something like that:</p>
  
  <pre><code>${#numbers.sequence(0, response.count)}
  </code></pre>
  
  <p>but didn't work.</p>
  
  <p>EDIT: I've tried that but didn't work too:</p>
  
  <pre><code>&lt;button th:each="i: ${#numbers.sequence(0, response.count - 1)}" th:class="${i == response.page} ?: active"&gt;Dummy&lt;/button&gt;
  </code></pre>