HtmlCalendar bean ver. 1.6

Java bean lets you generate Calendar for your HTML pages.
Let we see one example.

<title>Calendar demo</title>
<body bgcolor="white">
<jsp:useBean id="HtmlCal" scope="session" class="com.cj.htmlcal.HtmlCalendar" />

  // set parameters

<table width=300>
<tr><td nowrap>


And you will get the following output:
Mon Tue Wed Thu Fri Sat Sun
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30

Bean methods:

    HtmlCalendar ()


    // set/get year. Default value is current year
    public void setYear(int year)
    public int getYear()

    // set/get month (1-12). Default value is current month
    public void setMonth(int month)
    public int getMonth()

    // set/get style. HtmlCalendar.SUNDAY_FIRST or HtmlCalendar.MONDAY_FIRST
    // Default value is HtmlCalendar.SUNDAY_FIRST
    public void setStyle(int style)
    public int getStyle()

    // set/get Locale. Default value is Locale.US
    public void setLocale(Locale loc)
    public Locale getLocale()

    // set hyperlink. proceed request. Method returns empty string in case any error.
    // You can set hyperlink as a some url, e.g. "http://your_host/action.htm"
    // or as a name of javascript function, e.g. "myFunction"
    // Date will be passed as a get parameter to url request or as string value
    // to javascript. Format is yyyymmdd.
    // target_frame may be null or empty string.
    public void setAction(int day, String url_or_javascript, String target_frame)

    for the call setAction(24,"","_blank")
    hyperlink is: <a href="" target=_blank>24</a>

    for the call setAction(24,"myfunction","")
    hyperlink is: <a href="javascript:myfunction('20000624');">24</a>

    // you can set hyperlinks for all days of month
    public void setActions(String url_or_javascript, String target_frame)

 Note: See also Calendar taglib

 For downloading: htmlcal.jar (you have to put this file into WEB-INF/lib).

 © Coldbeans     Comments?

See also Coldtags suite - the largest collection of custom JSP tags.