Apache Click on Google App Engine - Hello World Example

Apache Click on Google App Engine – Hello World Example

Hello World!
If this blog would run on App Engine and was build with Apache Click I could finish this tutorial right here :).
But more seriously, I will describe short step by step tutorial on how to get started with Apache Click on Google App Engine.
I’m assuming that you have GAE plugin for eclipse installed already as well as the latest libraries for Apache Click downloaded somewhere on your machine. (If not look at my previous post on how to get started with Apache Click on Eclipse Galileo (here).

If all is set up, lets get started..

1. Add new GAE type ‘Web Application Project’ (the one with blue google icon)

2. Copy click-2.1.0.jar and click-extras-2.1.0.jar to the lib directory under war/WEB-INF/lib of your GAE project.

3. Click on the project and select ‘Properties’ when you will modify the ‘Java Build Path’.

When changing the build path, select the two libraries you have added to you lib folder in point 2.

4. Delete the auto-generated GAE project stuff, like servlet and index.html files.
5. Create new class called ‘Index’

package com.softwarepassion.clickgae;

import java.util.Date;
import org.apache.click.Page;

public class Index extends Page{
    private Date time = new Date();

    public Index() {
        addModel("time", time);


Note the package you choose for you newly created class file, it will be needed when modifying config files later.

6. Create click.xml file in the same location where your web.xml file exists.
7. Modify your web.xml file to look similar to the one presented below:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">

It looks like ordinary web.xml file with one important addition: the listener section.

8. Add content to your click.xml file:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<click-app charset="UTF-8">
    <page path="index.htm" classname="com.softwarepassion.clickgae.Index"></page>
  <mode value="development"/>

9. Add index.htm file to the war directory


    <h2>Hello World</h2>

    Hello world from Click at $time


10. Deploy your app to Google App Engine and go to the url: http://yourappname.appspot.com

You should see very simple website with current time printed.

One response on “Apache Click on Google App Engine – Hello World Example

Leave a Reply