title: How to use thymeleaf conditions - if - elseif - else
body: <p>I have a little problem, I must return a different choice of a select into a <code>td</code> using thymeleaf, I try the next sentence:</p>
  
  
  
  <pre class="lang-html prettyprint-override"><code>&lt;td style="white-space: nowrap"&gt;
      &lt;span th:class="${linea.estado}? 'label label-success' : 'label label-danger' : 'label label-warning'"
            th:text="${linea.estado}? #{label.glineas.estado.iniciado} : #{label.glineas.estado.finalizado} : #{label.glineas.estado.configurado}"&gt;
      &lt;/span&gt;
  &lt;/td&gt;
  </code></pre>
  
  <p>But I have a problem because the condition give me a big failure because is impossible to parse the expression. With only two conditions (iniciado and finalizado) there aren't problem, but I need to get the correct label for the select in my form.</p>
  
  <p>Anybody knows the correct sentence to use a if elseif else sentence with thymeleaf?</p>
  
  <p>2.0 Now I am trying to solve this problem with the next:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;td style="white-space: nowrap"&gt;
      &lt;span th:if="${linea.estado} == 'Iniciado'" class="label label-success" th:text="#{label.glineas.estado.iniciado}"&gt;&lt;/span&gt;
      &lt;span th:if="${linea.estado} == 'Finalizado'" class="label label-danger" th:text="#{label.glineas.estado.finalizado}"&gt;&lt;/span&gt;
      &lt;span th:if="${linea.estado} == 'Configuracion'" class="label label-warning" th:text="#{label.glineas.estado.configurado}"&gt;&lt;/span&gt;
  &lt;/td&gt;
  </code></pre>
  
  <p>The solution is perfect, now all works properly. Thanks for all.</p>