%@ taglib uri="/WEB-INF/calendar.tld" prefix="cal" %> <% //set appropriate headers response.setContentType("text/html; charset=utf-8"); //Calculations for changing the month displayed in the calendar controls String sCalendar = request.getParameter("Cal"); String sAmount = request.getParameter("Amount"); int iAmount = 0; try { iAmount = Integer.parseInt(sAmount); } catch(NumberFormatException e) { iAmount = 0; } int iDemoAmnt = 0; int iStartAmnt = 0; int iEndAmnt = 0; if((sCalendar!=null)&&(sCalendar.equals("Demo"))) { iDemoAmnt += iAmount; } if((sCalendar!=null)&&(sCalendar.equals("End"))) { iEndAmnt += iAmount; } if((sCalendar!=null)&&(sCalendar.equals("Start"))) { iStartAmnt += iAmount; } %>
The CalendarTag is used to generate an HTML display of a month by month calendar. The style of the display is controlled by a style sheet and so can fit the look and feel of any web application.
CalendarTag 1.2 was release August 2004 and contains the following new features:
Information about the version 1.0 release is still available.
There are two ways the calendar demo can be used. The first is to have the CalendarTag submit a request when the user selects a date and the second is to have the Calendar Tag execute some client side script when the user selects a date. These are both demonstrated below
For this demo clicking on a date on the calendar will submit a request that include parameters for the date selected.
This second demo uses the CalendarTag to set a date value in a text box of a form. A client side script is called with three parameters of day, month and year which allows the client code to define how the date is written to the field.
This demo displays the Calendar Tag in a new window and allows the user to set a date in the box below. It also demonstrates localisation by allowing the user select the language for the Calendar. The different style is controlled purely by CSS.
The CalendarTag is now available as a free download under license.