Emmanuel Benoist Home Page

Exercie JSF : Create your own component

Create a new facelet custom component TraficLight, that represents the value of a given property. The XHTML file should contain someting like:
<prefix:traficlight value="-1" />
which should be rendered like:
<img src="redlight.gif">
It should be also possible to have:
<prefix:traficlight value="#{mybean.property}" />
You can use the following images (if you have time you can create your own images ;-)):

The color green is used for positive values, yellow for zero and red for negative values.