Google Calendar API – sample codes

I’m continuing my Google Calendar API, and here are some sample codes. I added a table in HTML to display the retrieved calendar values. See the sample code below and the screenshots.

NOTE: in creating Java code in JSP, Java codes are executed first, then all values will be added in HTML transactions and scripts after, you just can’t make values in a JavaScript to change in a Java loop, and vise-versa. they do not run concurrently.


CalendarData cData = new CalendarData();
String testValue = cData.getDataFromStartServlet();

int sample = 0;
List <CalendarDataBean> CDataBeanList = cData.getDatabean();

String finalValue = "no value";

CalendarDataBean displayCalendarData =  cData.getDatabean().get(sample);

StringBuilder builder = new StringBuilder();
for(CalendarDataBean b: CDataBeanList){
    builder.append("<td>Event:" + b.getEventName() + "</td>");
    builder.append("<td>Start Time:" + b.getStartTime() + "</td>");
    builder.append("<td>End Time:" + b.getEndTime() + "</td>");

finalValue = builder.toString();

event_in_table_form event_in_table_form_calendar



Google Calendar API

I made a mini project before that can retrieve Google Calendar events and Data. The API is publicly provided by Google. Please see the screenshots I made. It was a Web application project deployed in Tomcat. It retrieves Google Calendar data from an account and displays the result in a website an in a Google compose mail window also.

The Google Calendar data. Notice the “Outdoor Hike” schedule, And how the other data is retrieved


(Simple Text) Calendar data displayed in a website
(Simple Text) Calendar data displayed in the Google compose mail page
the project files