title: JSTL- set background color with condition
body: <p>I am new to Java, JSTL, CSS, JSP... any of Java related and web application world.
  and I am learning and making my own web program at the same time (using Spring MVC). </p>
  
  <p>Now I am going to set 2 different background color by condition using JSTL in .jsp file. 
  My codition is median. so logic in jsp file with jstl should be like this:</p>
  
  <pre><code>if (value &lt; median)  
  // set background: green
  else
  // set background: red
  </code></pre>
  
  <p>I have done all the calculations for median value in Controller. 
  So my controller delivers median 
  and both the integer type and the string type of data </p>
  
  <p>(I noticed that integer type of data can't be presented on a browser page, correct? [Q1]</p>
  
  <p>So Integer type for conditional operation with median, string type for presentation on a browser)</p>
  
  <pre><code>model.addAttribute("dataNo", dataNo);
  model.addAttribute("dataStr", dataStr);
  model.addAttribute("dataInt", dataInt);
  model.addAttribute("median", median);
  </code></pre>
  
  <p>My. jsp like this</p>
  
  <p>(my table is increasing colum)</p>
  
  <pre><code>&lt;table class="table table-bordered"&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;c:forEach var="dataNoValue" items="${dataNo}"&gt;
                  &lt;th&gt;${dataNoValue}&lt;/th&gt;
              &lt;/c:forEach&gt;
  
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;c:forEach var="dataStrValue" items="${dataStr}"&gt;
                  &lt;th class="${dataInt &lt; median ? 'background-color: green':'background-color: red'}"&gt;${dataStrValue}&lt;/th&gt; -- [Q2] 
              &lt;/c:forEach&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>Yes, [Q2] is wrong, any suggestions? appreciated!</p>