Creating a Yearly Calendar

You can create a yearly calendar by including the output of month.jsp twelve times to represent each month of the year. You can specify the month by passing the month and year parameters to the included page as shown in Listing 3.12. Figure 3.10 shows how the yearly calendar would look for the year 2000.

Listing 3.12. year.jsp: Including the Output of the smallmonth JSP for Displaying the Year's Calendar
<table>
<%
    for (int i = 0; i < 12; i++) {
        if (i%3 == 0)
            out.println("<tr>");

%>
<td>
    <jsp:include page="smallmonth.jsp" flush="true">
					<jsp:param name="month" value="<%= i %>"/>
					<jsp:param name="year" value="2000"/>
					</jsp:include>
</td>
<%
        if (i%3+1 == 0)
            out.println("</tr>");
    }
%>
</table>
Figure 3.10. The Year ...

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.