Customizing the Calendar's Look

In this section, we will break the monotony of the unistyle calendar generated by month.jsp by providing themes. These themes represent a particular style for the different HTML elements: the background of the page, the month name, and the day names of the generated calendar.

One approach for generating the stylized calendar would be to extract the HTML element's information for a specified theme and embed it directly into the HTML element for generating the month name's background, as shown following. The information about the themes can be stored in files, databases, or other data stores.

<tr bgcolor="<%= database.getColorForMonthName("theme")%>"> <td colspan="7"&nbsp;<font size="+2"> <%= cal.getMonthName()%></font> ...

Get Java Server Pages from scratch now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.