title: JSTL JSP ternary if in expression language
body: <p><strong>Specifically about problem:</strong></p>
  <p>I have two tags</p>
  <p>It's work:</p>
  <pre><code>&lt;td style=&quot;color: ${mealTo.excess ? &quot;red&quot; : &quot;green&quot;}&quot;&gt;${mealTo.dateTime}&lt;/td&gt;
  </code></pre>
  <p>It don't work:</p>
  <pre><code>&lt;c:set var=&quot;colorText&quot; value=&quot;${mealTo.excess ? &quot; red&quot; : &quot;green&quot;}&quot;/&gt;
  </code></pre>
  <p><a href="https://i.stack.imgur.com/tpgKx.png" rel="nofollow noreferrer">code from IDE</a></p>
  <p>Why don't work ternary if in expression language?</p>
  <p><strong>More about the problem:</strong></p>
  <p>Two tags duplicates the code in expression language:</p>
  <pre><code>&lt;td style=&quot;color: ${mealTo.excess ? &quot;red&quot; : &quot;green&quot;}&quot;&gt;${mealTo.dateTime}&lt;/td&gt;
  &lt;td style=&quot;color: ${mealTo.excess ? &quot;red&quot; : &quot;green&quot;}&quot;&gt;${mealTo.description}&lt;/td&gt;
  </code></pre>
  <p>I want this code place in jstl variable and use it:</p>
  <pre><code>&lt;c:set var=&quot;colorText&quot; value=&quot;${mealTo.excess ? &quot; red&quot; : &quot;green&quot;}&quot;/&gt;
  &lt;td style=&quot;color: ${colorText}&quot;&gt;${mealTo.dateTime}&lt;/td&gt;
  &lt;td style=&quot;color: ${colorText}&quot;&gt;${mealTo.description}&lt;/td&gt;
  </code></pre>
  <p>But IDE suggests what first tag with jstl variable incorrect.</p>
  <p>Thanks!</p>