_______ Feed on Posts or Comments

english & programming & web Franchu on 10 Apr 2007 10:23 pm

iCal JSP taglib


Last week I needed to create some iCal feeds populating the list of events from a database in a Tomcat + MySQL environment.

The first impulse was to create a JSP file that complies with the iCal format defined in the RFC2445 but in the end it resulted in an ugly and unmaintainable code. So the idea died on the spot and another solution was to be found.

Fortunately, there is a nice library called iCal4j developed by Ben Fortuna that makes it very easy to create iCal compatible files from a Java application. Then, the natural solution would have been to create a servlet that would output the iCal file, but the code that I was developing was to be maintained by many people that are not necessarily comfortable coding in Java.

That is why, I started a new project iCal-taglib, that provides a JSP taglib wrapper around the functionality implemented in the library iCal4j. There is still a lot of functionality to be implemented, but at least now, creating a calendar from any JSP page is as easy as:

<ical:calendar>
<ical:event>
<ical:summary>Test</ical:summary>
<ical:startdate>2007-04-10</ical:startdate>
</ical:event>
</ical:calendar>

to create the iCal compatible text:

BEGIN:VCALENDAR
PRODID:-//Miguel Gil Biraud//ical-taglib 0.1//based on iCal4j 1.0//EN//
VERSION:2.0
METHOD:PUBLISH
CALSCALE:GREGORIAN
BEGIN:VEVENT
DTSTAMP:20070410T183339Z
UID:detczmfg5tgah0ldwfkf8@franchu.net
SUMMARY:Test
DTSTART;VALUE=DATE:20070410
END:VEVENT
END:VCALENDAR

In order to use it, you need to download the iCal4j files and the ical-taglib files and place them in the WEB-INF/lib folder of you application server.

Much development is still needed, but the taglib implements so far the basic functionality needed to create simple calendars that are accepted by the main calendaring software available in the market.

Related posts:

  1. Nerding wishlist (16/12/07)
  2. Google Calendar con soporte CalDAV
  3. How to create a mashup and not die trying…
  4. Free education: eLearning to the rescue
  5. Solaris 10 on a MacBook Pro

Trackback This Post | Subscribe to the comments through RSS Feed

Leave a Reply