Apache Click is a page and component oriented
web application framework
A web framework (WF) or web application framework (WAF) is a software framework that is designed to support the development of web applications including web services, web resources, and web APIs. Web frameworks provide a standard way to build and ...
for the
Java language
Java is a high-level, general-purpose, memory-safe, object-oriented programming language. It is intended to let programmers ''write once, run anywhere'' ( WORA), meaning that compiled Java code can run on all platforms that support Java w ...
and is built on top of the
Java Servlet
A Jakarta Servlet, formerly Java Servlet is a Java (programming language), Java software component that extends the capabilities of a server (computing), server. Although servlets can respond to many types of requests, they most commonly impl ...
API
An application programming interface (API) is a connection between computers or between computer programs. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how to build ...
.
It is a free and
open-source
Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use and view the source code, design documents, or content of the product. The open source model is a decentrali ...
project distributed under the
Apache license
The Apache License is a permissive free software license written by the Apache Software Foundation (ASF). It allows users to use the software for any purpose, to distribute it, to modify it, and to distribute modified versions of the software ...
and runs on any
JDK installation (1.5 or later).
Click was initially created by Malcolm Edgar as the click.sourceforce.net project in 2003. The project then graduated to an
Apache
The Apache ( ) are several Southern Athabaskan language-speaking peoples of the Southwestern United States, Southwest, the Southern Plains and Northern Mexico. They are linguistically related to the Navajo. They migrated from the Athabascan ho ...
top-level project in November 2009 with Bob Schellink. The project was retired in May 2014.
Overview
The main design goals are simplicity, ease of use, performance and scalability. To achieve these goals Click leverages an intuitive page and component oriented design.
Pages and components provide good encapsulation of web concepts and enables rapid application development.
Click takes a pragmatic approach and expose few abstractions to learn and understand. The
Java Servlet
A Jakarta Servlet, formerly Java Servlet is a Java (programming language), Java software component that extends the capabilities of a server (computing), server. Although servlets can respond to many types of requests, they most commonly impl ...
API
An application programming interface (API) is a connection between computers or between computer programs. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how to build ...
is fully exposed to the developer which eases the upgrade path from an action based framework to a component based one.
Pages and components are developed in
Java
Java is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
while templates can be written in
Velocity
Velocity is a measurement of speed in a certain direction of motion. It is a fundamental concept in kinematics, the branch of classical mechanics that describes the motion of physical objects. Velocity is a vector (geometry), vector Physical q ...
,
FreeMarker or
JSP. Components know how to draw themselves alleviating developers from maintaining redundant markup.
A major difference between Click and other component oriented web frameworks is that Click is stateless by design, although stateful pages are supported.
Competing frameworks
There are a number of other component oriented frameworks available for Java such as
JSF,
Tapestry
Tapestry is a form of Textile arts, textile art which was traditionally Weaving, woven by hand on a loom. Normally it is used to create images rather than patterns. Tapestry is relatively fragile, and difficult to make, so most historical piece ...
,
WebObjects
WebObjects is a discontinued Java web application server and a server-based web application framework originally developed by NeXT Software, Inc.
WebObject's hallmark features are its object-orientation, database connectivity, and prototy ...
,
Apache Wicket
Apache Wicket, commonly referred to as Wicket, is a component-based web application framework for the Java programming language conceptually similar to JavaServer Faces and Tapestry. It was originally written by Jonathan Locke in April 2004. Ver ...
and
Vaadin
Vaadin () is an open-source web application development platform for Java. Vaadin includes a set of Web Components, a Java web framework, and a set of tools that enable developers to implement modern web graphical user interfaces (GUI) using the ...
.
Some developers prefer the more traditional action-based web frameworks including
Apache Struts
Apache Struts 2 is an open-source web application framework for developing Java EE web applications. It uses and extends the Java Servlet API to encourage developers to adopt a model–view–controller (MVC) architecture. The WebWork framework s ...
,
Spring MVC, and
Stripes.
Example
A
Hello World
Hello World may refer to:
* "Hello, World!" program, a computer program that outputs or displays the message "Hello, World!"
Music
* "Hello World!" (composition), song by the Iamus computer
* "Hello World" (Tremeloes song), 1969
* "Hello World" ...
Click application, with four files:
; hello-world.htm
: The default template engine for Click is
Velocity
Velocity is a measurement of speed in a certain direction of motion. It is a fundamental concept in kinematics, the branch of classical mechanics that describes the motion of physical objects. Velocity is a vector (geometry), vector Physical q ...
, the htm file will be similar to a normal, static
HTML
Hypertext Markup Language (HTML) is the standard markup language for documents designed to be displayed in a web browser. It defines the content and structure of web content. It is often assisted by technologies such as Cascading Style Sheets ( ...
page.
; HelloWorld.java
: The page model that will be bound to the template.
package org.wikipedia.click;
import org.apache.click.Page;
public class HelloWorld extends Page
; click.xml
: The heart of a Click application is the
click.xml
configuration file. This file specifies the application pages, headers, the format object and the applications mode.
: Click is smart enough to figure out that the
HelloWorld
page class maps to the template
hello-world.htm
. We only have to inform Click of the package of the
HelloWorld
class, in this case
org.wikipedia.click
. We do that through the
click.xml
configuration file which allows Click to map
hello-world.htm
requests to the
org.wikipedia.click.HelloWorld
page class.
: By default the
ClickServlet
will attempt to load the application configuration file using the path:
/WEB-INF/click.xml
; web.xml
: The
servlet
A Jakarta Servlet, formerly Java Servlet is a Java software component that extends the capabilities of a server. Although servlets can respond to many types of requests, they most commonly implement web containers for hosting web applicat ...
application definition.
Click Example
click-servlet
org.apache.click.ClickServlet
0
click-servlet
*.htm
Bibliography
*
See also
*
Comparison of web frameworks
References
External links
*
{{DEFAULTSORT:Click Framework
Java enterprise platform
Web frameworks