Apache Click
Encyclopedia
Apache Click is a modern page and component oriented web application framework
Web application framework
A web application framework is a software framework that is designed to support the development of dynamic websites, web applications and web services. The framework aims to alleviate the overhead associated with common activities performed in Web development...

 for the Java language
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...

 and is built on top of the Java Servlet
Java Servlet
A servlet is a Java programming language class used to extend the capabilities of servers that host applications accessed via a request-response programming model. Although servlets can respond to any type of request, they are commonly used to extend the applications hosted by Web servers...

 API
Application programming interface
An application programming interface is a source code based specification intended to be used as an interface by software components to communicate with each other...

.

It is a free and open-source project distributed under the Apache license
Apache License
The Apache License is a copyfree free software license authored by the Apache Software Foundation . The Apache License requires preservation of the copyright notice and disclaimer....

 and runs on any JDK installation (1.5 or later).

Click graduated into an Apache
Apache Software Foundation
The Apache Software Foundation is a non-profit corporation to support Apache software projects, including the Apache HTTP Server. The ASF was formed from the Apache Group and incorporated in Delaware, U.S., in June 1999.The Apache Software Foundation is a decentralized community of developers...

 top-level project in November 2009.

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
Java Servlet
A servlet is a Java programming language class used to extend the capabilities of servers that host applications accessed via a request-response programming model. Although servlets can respond to any type of request, they are commonly used to extend the applications hosted by Web servers...

 API
Application programming interface
An application programming interface is a source code based specification intended to be used as an interface by software components to communicate with each other...

 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 while templates can be written in Velocity
Jakarta Velocity
Apache Velocity is an open source software project directed by the Apache Software Foundation. Velocity is a Java-based template engine that provides a simple yet powerful template language to reference objects defined in Java code...

, FreeMarker
FreeMarker
FreeMarker is a Java-based template engine focusing on the MVC software architecture. Although it's mostly used for Servlet-based Web Application development, it can be used for any other kind of text output, such as generating CSS, Java source code, etc. Unlike JSP, it is not dependent on the...

 or JSP
JavaServer Pages
JavaServer Pages is a Java technology that helps software developers serve dynamically generated web pages based on HTML, XML, or other document types...

. 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
JavaServer Faces
JavaServer Faces is a Java-based Web application framework intended to simplify development integration of web-based user interfaces....

, Tapestry
Tapestry (programming)
Apache Tapestry is an open-source component-oriented Java web application framework to implement applications in accordance with the model-view-controller architectural pattern. Tapestry was created by Howard Lewis Ship independently, and was adopted by the Apache Software Foundation as a top-level...

, WebObjects
WebObjects
WebObjects was a Java web application server from Apple Inc., and a web application framework that ran on the server. It was available at no additional cost. Its hallmark features were its object-orientation, database connectivity, and prototyping tools...

 and Apache Wicket.

Some developers prefer the more traditional action-based web frameworks including Apache Struts
Apache Struts
Apache Struts 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 architecture. It was originally created by Craig McClanahan and donated to the Apache Foundation in...

, Spring MVC
Spring Framework (Java)
The Spring Framework is an open source application framework for the Java platform.The first version was written by Rod Johnson, who released the framework with the publication of his book Expert One-on-One J2EE Design and Development in October 2002. The framework was first released under the...

, and Stripes
Stripes (framework)
-External links:********...

.

Example

A Hello World Click application, with four files:

hello-world.htm
The default template engine for Click is Velocity, the htm file will be similar to a normal, static HTML
HTML
HyperText Markup Language is the predominant markup language for web pages. HTML elements are the basic building-blocks of webpages....

 page.

HelloWorld.java
The page model that will be bound to the template.

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
Java Servlet
A servlet is a Java programming language class used to extend the capabilities of servers that host applications accessed via a request-response programming model. Although servlets can respond to any type of request, they are commonly used to extend the applications hosted by Web servers...

application definition.


External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK