title: Using JSP to return a CSS class style from Java
body: <p>I'm new to JSP so with this question I'm really just wondering if I have right idea about how JSP works. But anyway, I'm developing this web app where I need to fill a table with some values and color some of them green, some of them red, and some of them gray. What color they have is determined by the Java object that backs all of the values for each row. So this was my idea:</p>
  
  <pre><code>&lt;td class="&lt;%detail.getClassStyle()%&gt;"&gt;&lt;%= detail.getStatus() %&gt;&lt;/td&gt;
  </code></pre>
  
  <p>which I had hoped would have turned out like this after the methods returned:</p>
  
  <pre><code>&lt;td class="red"&gt;Down&lt;/td&gt;
  </code></pre>
  
  <p>But it doesn't work. In the web page's source code class just says class="". So am I missing the point of how JSP works? And whether I am or not, could someone propose an idea of how to get my intended result?</p>
  
  <p>Edit:
  There's also an additional class attribute getClassStyle() returns which denotes the column the cell is in. Something like:
      td class="detail red">Down
  So simply just coloring it red is not something I'd like to do.</p>