The usage of Calendar taglib
This file contains a sample for Calendar taglib.
Here we are demonstrating the intensive usage for setDateBody tag. This tag lets you describe your own
HTML code for calendar's cells. For example:
<%@ taglib uri="taglib.tld" prefix="cal" %>
<!-- style for our cells -->
<style>
.test
{
color:white;
background:gray;
width:150px;
height:85px;
}
</style>
<cal:Calendar month="07" year="2002" header="true" locale="<%=java.util.Locale.ENGLISH%>">
<!-- use the above described style -->
<cal:setDateClass>test</cal:setDateClass>
<!-- body for all our cells. D is a current day -->
<cal:setDateBody>
<table width="100%" border="1" class="test">
<tr>
<table border="0">
<tr><td align="right" valign="top"><%=D%></td></tr>
</table>
</td></tr>
</table>
</cal:setDateBody>
<!-- now we have something special for day 5 -->
<cal:setDateBody day="5">
<table width="100%" border="1" class="test">
<tr> |
<table border="0">
<tr><td align="right" valign="top"><%=D%></td></tr>
<tr><td><font color="red">HRMC/PBCH ED</td></tr>
</table>
</td></tr>
</table>
</cal:setDateBody>
<!-- and one remark for 26-th as well -->
<cal:setDateBody day="26">
<table width="100%" border="1" class="test">
<tr> |
<table border="0">
<tr><td align="right" valign="top"><%=D%></td></tr>
<tr><td><font color="green">Joseph Robert covering</td></tr>
</table>
</td></tr>
</table>
</cal:setDateBody>
</cal:Calendar>
and you will get some like this:
| Jul 2002 | |
|
Mon | Tue | Wed | Thu | Fri | Sat | Sun |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
Joseph Robert covering |
|
|
|
|
|
|
|
|
|
|
|
© Coldbeans Comments?
See also Other tips from Coldbeans.
|