Hi there i am a bit rubbish at Java to say the least so i'm sure you guys will solve this problem like a shot. Just a quick question about dynamically changing table row colour.

Anyway, i have a table where i want to display some data, and i want the colour of the table row to alternate so they stand out from the background of the page. Anyway one of the rows will not be displayed if a certain criteria is not met (i.e. they are over 60 and are not eligible for cover).

As i want table row colour to alternate i cannot set it beforehand, it has to be done dynamically. What i need to do is evaluate whether the age variable is < 60 (which has been done already in the page to show/hide one of the rows) if it is then row 4 of the table needs to have the highlightRow style applied to it, if not then row 5 needs the hightlightRow style.

Sorry that is a very long and confusing explanation for a very simple problem, but here is the offending table below with my attempt at dynamically appliying the style to the table row. I think it might be because i am trying to insert the java code into the <tr> tag, can i do this or is it a big no no?

Code:
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="0">
                                   <tr>
                                     <td width="42%" height="35">&nbsp;</td>
                                     <td width="25%" align="center" class="tableLabelText">Premium</td>
                                     <td width="33%" align="center" class="tableLabelText">Coverage</td>
                                   </tr>
                                   <tr class="highlightRow">
                                     <td height="25"><div class="summaryText">Road &amp; Travel Plan</div></td>
                                     <td align="center"><div class="summaryText">&pound;<%= session.getAttribute("valueRTP") %></div></td>
                                     <td align="center"><div class="summaryText">
<%

String a1 = ((session.getAttribute("RtpInsSilv")== null)?"":session.getAttribute("RtpInsSilv")).toString();
String b1 = ((session.getAttribute("RtpInsGold")== null)?"":session.getAttribute("RtpInsGold")).toString();

String c1 = ((session.getAttribute("RtpInsPartSilv")== null)?"":session.getAttribute("RtpInsPartSilv")).toString();
String d1 = ((session.getAttribute("RtpInsPartGold")== null)?"":session.getAttribute("RtpInsPartGold")).toString();

String e1 = ((session.getAttribute("RtpInsChildSilv")== null)?"":session.getAttribute("RtpInsChildSilv")).toString();
String f1 = ((session.getAttribute("RtpInsChildGold")== null)?"":session.getAttribute("RtpInsChildGold")).toString();

String g1 = ((session.getAttribute("RtpFamSilv")== null)?"":session.getAttribute("RtpFamSilv")).toString();
String h1 = ((session.getAttribute("RtpFamGold")== null)?"":session.getAttribute("RtpFamGold")).toString();
 
	if ((a1.equals("Checked") || b1.equals("Checked")))
    {
			out.println("Single");
    }
	if ((c1.equals("Checked")|| d1.equals("Checked")))
			{
       out.println("Joint");
      }
	if ((e1.equals("Checked")|| f1.equals("Checked")))
			{
       out.println("Single &amp; Children");
      }
	if ((g1.equals("Checked")|| h1.equals("Checked")))
			{
       out.println("Family");
      }		
    
     
	%>
									 </div></td>
                                   </tr>
								   <%
								String mpcheck = (String)session.getAttribute("YA_ya");
                int x =  new Integer(mpcheck).intValue();								
								if (x < 60)
								{
								%>
                                   <tr>
                                     <td height="25"><div class="summaryText">Motorcycle Plan</div></td>
                                     <td align="center"><div class="summaryText">&pound;<%= session.getAttribute("valueMP") %></div></td>
                                     <td align="center"><div class="summaryText">
									 <%
   

String a2 = ((session.getAttribute("MpIns")== null)?"":session.getAttribute("MpIns")).toString();

String b2 = ((session.getAttribute("MpInsPart")== null)?"":session.getAttribute("MpInsPart")).toString();
  
	if ((a2.equals("Checked")))
    {
			out.println("Single");
    }
	if ((b2.equals("Checked")))
			{
       out.println("Joint");
      }
	
    else
      {
			out.println(" ");
      }
           
%>
									 </div></td>
                                   </tr>
								   <%
								   }
								   %>
                                   <tr class="<%= if (x < 60){'highlightRow'} %>">
                                     <td height="25"><div class="summaryText">Total Monthly Premium</div></td>
                                     <td align="center"><div class="summaryText">&pound;<%= session.getAttribute("valueTotal") %></div></td>
                                     <td>&nbsp;</td>
                                   </tr>
                                   <tr class="<%= if (x > 59){'highlightRow'} %>">
                                     <td height="25"><div class="summaryText">Total Annual Premium</div></td>
                                     <td align="center"><div class="summaryText">&pound;<%= session.getAttribute("AnvalueTotal") %></div></td>
                                     <td>&nbsp;</td>
                                   </tr>
                                   <tr>
                                     <td>&nbsp;</td>
                                     <td>&nbsp;</td>
                                     <td>&nbsp;</td>
                                   </tr>
                                   <tr>
                                     <td height="25" class="tableLabelText">Amount Due Now</td>
                                     <td align="center" class="tableLabelText">&pound;<%= session.getAttribute("valueTotal") %></td>
                                     <td>&nbsp;</td>
                                   </tr>
                              </table>

Suffice to say it did not work, any ideas anybody? Like i say i'm really bad at Java so i've probably done something really stupid.

Cheers