Go to www.w3c.org and search 4 css (to get more info)
4 your sample here
create a file ( say common.css ) and write

.warning {
background-color: #FF8000;
}
.error {
background-color: #FF0000;
}
.normal {
background-color: #FFFFFF; }
in your html/jsp header section insert
<link rel="stylesheet" href="/path_to_css/common.css" TYPE="text/css"/>

the you can refer these styles with class tag attribute (ex.: <td class='normal'>)


ciao,
kiuma

ps.:
stop to insert java conde in your jsp pages. Make a small effort and try to use only tags

Heligon Sandra wrote:

Thanks a lot for your example, but is it possible to not
mix Java code with Struts/HTML tags ?

-----Original Message-----
From: Sri Sankaran [mailto:Sri.Sankaran@;sas.com]
Sent: 23 October 2002 18:32
To: Struts Users Mailing List
Subject: RE: Conditional colour cell with logic:iterate


Oops...
The .normal class must be terminated with a brace:
<style>
.warning {
background-color: #FF8000;
}
.error {
background-color: #FF0000;
}
.normal {
background-color: #FFFFFF; /* or whatever your normal background color may be */
} <--- This was missing

</style>


-----Original Message-----
From: Sri Sankaran Sent: Wednesday, October 23, 2002 12:30 PM
To: Struts Users Mailing List
Subject: RE: Conditional colour cell with logic:iterate


<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>


--
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>

.


--
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