title: Changing the color of row depending on a status variable
body: <p>I am having a table which is made based on data fetching from database.Now i want to change the color of rows depending on weather the readstatus of that row in database is "YES" or "NO".
  So my code to do it is as follow : </p>
  
  <pre><code>&lt;% while(rs.next())
  { 
  String messageid=rs.getString("MESSAGE_ID");
  String sendername=rs.getString("EMAIL_FROM");
  String messagesubject=rs.getString("EMAIL_SUBJECT");
  Timestamp sendingtime=rs.getTimestamp("EMAIL_TIME");
  String readstatus=rs.getString("READSTATUS");
  if(readstatus.compareTo("NO")==0)%&gt;
      &lt;tr bgcolor="66FF00"&gt;    &lt;/tr&gt;
  &lt;%
  if(readstatus.compareTo("YES")==0)
  %&gt;
  &lt;tr bgcolor="660000"&gt;    &lt;/tr&gt;
  
  &lt;tr onmouseover="ChangeColor(this, true);" onmouseout="ChangeColor(this, false);" onclick="DoNav('showmail.jsp?mid=&lt;%=messageid%&gt;');"&gt;    
  &lt;td callspan="3"&gt;&lt;%=sendername%&gt;  :   &lt;%=messagesubject%&gt;      &lt;%=sendingtime%&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr/&gt;
  
  &lt;% 
  
  } %&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>But the color of all the rows is still shown same.Whats wrong in this code?</p>
  
  <p>Secondly , i want the sending time to be shown atmost right side and sendername at nost left and messagesubject in middle of my row in table.How to do that ?</p>