Apache Click
Apache Click is a page and component oriented web application framework for the Java language and is built on top of the Java Servlet API. It is a free and open-source project distributed under the Apache license 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 top-level project in November 2009 with Bob Schellink. The project was retired in May 2014.[2] OverviewThe 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 API 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, 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 frameworksThere are a number of other component oriented frameworks available for Java such as JSF, Tapestry, WebObjects, Apache Wicket and Vaadin. Some developers prefer the more traditional action-based web frameworks including Apache Struts, Spring MVC, and Stripes. ExampleA Hello World Click application, with four files:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<body>
<p>$message</p>
</body>
</html>
package org.wikipedia.click;
import org.apache.click.Page;
public class HelloWorld extends Page {
/**
* Constructor
*/
public HelloWorld() {
// Add the value to the map ("message" = "$message")
addModel("message", "Hello World!");
}
}
<?xml version="1.0" encoding="UTF-8"?>
<click-app>
<pages package="org.wikipedia.click"/>
</click-app>
<?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">
<display-name>Click Example</display-name>
<servlet>
<servlet-name>click-servlet</servlet-name>
<servlet-class>org.apache.click.ClickServlet</servlet-class>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>click-servlet</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
</web-app>
Bibliography
See alsoReferences
External links |