<style>
.warning {
  background-color: #FF8000;
}
.error {
  background-color: #FF0000;
}
.normal {
  background-color: #FFFFFF; 
  /* or whatever your normal background color may be */
</style>
<table>
  <logic:iterate id="anItem" 
               name="aBean" 
           property="list">
    <tr>
      <td><!-- Id --></td>
      <td><!-- Name --></td>  
      <%
         String cellClass = null;
         String status = anItem.getStatus();
         if("WARNING".equals(status) {
           cellClass = "warning";
         } else if("ERROR".equals(status) {
           cellClass = "error";
         } else {
           cellClass = "normal";
         }
      %>    
      <td class="<%=cellClass%>">
        <!-- Display status -->
      </td>
</table>

HTH

Sri

-----Original Message-----
From: Heligon Sandra [mailto:sandra.heligon@;nextream.fr] 
Sent: Wednesday, October 23, 2002 11:58 AM
To: '[EMAIL PROTECTED]'
Subject: Conditional colour cell with logic:iterate



        I will wish to know how to modify the colour of a cell according to the value 
of a bean's property.

        I have the following list

        Id   Name  Status

        I use logic:iterate tag to construct the list.

        The status property can take the following values: OK  WARNING (orange), ERROR 
(red)
        I would like to make the background colour of the column status   -
green for status ok
        
- orange for status warning
        
- red for status error

        How can I do that ?

        thanks,
        Sandra

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>

Reply via email to