This document describes all the attributes found in the CalendarTag and their use.
addMonthUsed to add or subtract a number of months from the current system month. The
Calendar Tag when displayed without any attributes always displays the month for
the current system date. Using addMonths you can roll the display
to a future month or if using a negative value a previous month.
For example, to display the previous month with respect to this month use,
<cal:calendar addMonths="-1" />
See also month and year attributes.
compatabilityNew in version 1.2
Accepted values: "HTML", "XHTML". Default: "HTML"
This takes a value of "HTML" or "XHTML" and will cause the CalendarTag to
render HTML 4.01 Strict compliant code or XHTML 1.0 Strict compliant code. Note,
you will need to set the DOCTYPE of your page accordingly. If this
attribute is not specified the default is HTML 4.01 Strict compliance. For the
most part the generated mark up is the same for both HTML and XHTML with the
only difference beign the rendering of the input tags.
For more information on HTML please refer to the HTML 4.01 Specification and for further information on XHTML please refer to the XHTML Specification Article.
Example,
<cal:calendar compatability="XHTML" />
localeSpecifies the locale (language) used when displaying the calendar. The CalendarTag will recognise the locale sent by the browser but you can use this attribute to override that setting. The available locales are determined by the JDK and for a list of supported locales for JDK 1.4.1 see the Supported Locales document.
monthThe month attribute sets the month to display. In conformance with how
dates are handled in the JDK the months of the year are number 0 for January to
11 for December.
You would usually use month and year attributes
together to specify both a month and year. If you use month on its
own the year defaults to the current year. For example, to display the calendar
for march of this year use,
<cal:calendar month="2" />
scriptThe script attribute is used to define the name of a JavaScript
function that will execute when the user clicks on a date in the calendar. The
function is passed three parameters of the value of the day, month and year of
the date selected. You therefore need to write a function that accepts these
parameters. The following example defines a function called selectDate,
<cal:calendar script="selectDate" />
<script type='text/JavaScript'>
function selectDate(var day, var month, var year)
{
alert("day=" + day + " month=" + month + " year=" + year);
return false;
}
</script>
timezoneOptional, defines the timezone for the CalendarTag. You may wish to use this attribute to define a timezone for the user if they are likely to be in a different timezone than the web server. This will then correctly define the current day for the user.
The syntax of the attribute value is "GMT" and then plus or minus a certain number of hours and minutes. For example,
<cal:calendar timezone="GMT+04:00" />
This above example would set the timezone for the calendar tag to 4 hours
ahead of GMT. You can determine the timezone of the user's browser by using
the client side javascript function date.getTimezoneOffset().
You will then need to pass this value to the server so that the server can set
the timezone for that user's calendar.
todayNew in version 1.2.
Optional, will toggle the display of the 'Today' button. If this is given a value of "true", "on" or "yes" then the Today button will be displayed, any other value or if the attribute is not present and it will not be displayed.
The Today button when selected by the user will execute either a defined client side script or submit a request a defined URL in the same manner as if the user clicked on todays date in the Calendar display.
See also tomorrow and yesteray attributes.
tomorrowNew in version 1.2.
Optional, will toggle the display of the 'Tomorrow' button. If this is given a value of "true", "on" or "yes" then the Tomorrow button will be displayed, any other value or if the attribute is not present and it will not be displayed.
The Tomorrow button when selected by the user will execute either a defined client side script or submit a request to the defined URL in the same manner as if the user clicked on tomorrows date in the Calendar display.
See also today and yesteray attributes.
urlUse this attribute to define a URL that will be request when the user clicks on a date in the calendar display. The URL is appended with parametrs Day, Month and Year so that the requested page can determine which day the user selected.
So if you define a CalendarTag with a url such as
<cal:calendar url="/setStartDate.jsp" />
then if the user selects January 27th, 1973 then the hyperlink that is constructed would be
<a href="/setStartDate.jsp?Day=27&Month=0&Year=1973"> 1 </a>
yearThe year attribute sets the year to display. You would usually
use month and year attributes together to specify
both a month and year. If you use year on its own the month
defaults to the current month. For example, to display March 1980,
<cal:calendar month="2" year="1980" />
yesterdayNew in version 1.2.
Optional, will toggle the display of the 'Yesterday' button. If this is given a value of "true", "on" or "yes" then the Yesterday button will be displayed, any other value or if the attribute is not present and it will not be displayed.
The Yesterday button when selected by the user will execute either a defined client side script or submit a request to the defined URL in the same manner as if the user clicked on yesterdays date in the Calendar display.
See also today and tomorrow attributes.