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



One thought on “Google Calendar API – sample codes

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s