Wicket framework
Encyclopedia
Apache Wicket, commonly referred to as Wicket, is a lightweight component-based 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 programming 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...

 conceptually similar to JavaServer Faces
JavaServer Faces
JavaServer Faces is a Java-based Web application framework intended to simplify development integration of web-based user interfaces....

 and 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...

. It was originally written by Jonathan Locke in April 2004. Version 1.0 was released in June 2005. It 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 June 2007.

Rationale

Traditional MVC
Model-view-controller
Model–view–controller is a software architecture, currently considered an architectural pattern used in software engineering. The pattern isolates "domain logic" from the user interface , permitting independent development, testing and maintenance of each .Model View Controller...

 frameworks work in terms of whole requests and whole pages. In each request cycle, the incoming request is mapped to a method on a controller object, which then generates the outgoing response in its entirety, usually by pulling data out of a model to populate a view written in specialised template markup
Web template
A web template is a tool used to separate content from presentation in web design, and for mass-production of web documents. It is a basic component of a web template system.Web templates can be used to set up any type of website...

. This keeps the application's flow-of-control
Control flow
In computer science, control flow refers to the order in which the individual statements, instructions, or function calls of an imperative or a declarative program are executed or evaluated....

 simple and clear, but can make code reuse
Code reuse
Code reuse, also called software reuse, is the use of existing software, or software knowledge, to build new software.-Overview:Ad hoc code reuse has been practiced from the earliest days of programming. Programmers have always reused sections of code, templates, functions, and procedures...

 in the controller difficult.

Design

Wicket, on the other hand, is closely patterned after stateful GUI
Gui
Gui or guee is a generic term to refer to grilled dishes in Korean cuisine. These most commonly have meat or fish as their primary ingredient, but may in some cases also comprise grilled vegetables or other vegetarian ingredients. The term derives from the verb, "gupda" in Korean, which literally...

 frameworks such as Swing
Swing (Java)
Swing is the primary Java GUI widget toolkit. It is part of Oracle's Java Foundation Classes — an API for providing a graphical user interface for Java programs....

. Wicket applications are trees of components, which use listener delegates
Delegation (programming)
In object-oriented programming, there are two related notions of delegation.* Most commonly, it refers to a programming language feature making use of the method lookup rules for dispatching so-called self-calls as defined by Lieberman in his 1986 paper "Using Prototypical Objects to Implement...

 to react to HTTP requests against links and forms in the same way that Swing components react to mouse and keystroke events. Wicket is categorized as a component-based framework.

Wicket uses plain XHTML
XHTML
XHTML is a family of XML markup languages that mirror or extend versions of the widely-used Hypertext Markup Language , the language in which web pages are written....

 for templating (which enforces a clear separation of presentation and business logic
Business logic
Business logic, or domain logic, is a non-technical term generally used to describe the functional algorithms that handle information exchange between a database and a user interface.- Scope of business logic :Business logic:...

 and allows templates to be edited with conventional WYSIWYG
WYSIWYG
WYSIWYG is an acronym for What You See Is What You Get. The term is used in computing to describe a system in which content displayed onscreen during editing appears in a form closely corresponding to its appearance when printed or displayed as a finished product...

 design tools). Each component is bound to a named element in the XHTML and becomes responsible for rendering that element in the final output. The page is simply the top-level containing component and is paired with exactly one XHTML template. Reuseable parts of pages may be abstracted into components called panels, which can then be pulled whole into pages or other panels with a special tag.

Each component is backed by its own model, which represents the state of the component. The framework does not have knowledge of how components interact with their models, which are treated as opaque
Black box
A black box is a device, object, or system whose inner workings are unknown; only the input, transfer, and output are known characteristics.The term black box can also refer to:-In science and technology:*Black box theory, a philosophical theory...

 objects automatically serialized
Serialization
In computer science, in the context of data storage and transmission, serialization is the process of converting a data structure or object state into a format that can be stored and "resurrected" later in the same or another computer environment...

 and persisted
Object persistence
System prevalence is a simple software architectural pattern that combines system images and transaction journaling to provide speed, performance scalability, transparent persistence and transparent live mirroring of computer system state....

 between requests. More complex models, however, may be made detachable and provide hooks to arrange their own storage and restoration at the beginning and end of each request cycle. Wicket does not mandate any particular object-persistence or ORM
Object-relational mapping
Object-relational mapping in computer software is a programming technique for converting data between incompatible type systems in object-oriented programming languages. This creates, in effect, a "virtual object database" that can be used from within the programming language...

 layer, so applications often use some combination of Hibernate
Hibernate (Java)
Hibernate is an object-relational mapping library for the Java language, providing a framework for mapping an object-oriented domain model to a traditional relational database...

 objects, EJBs or POJO
Pojo
Pojo may refer to:* Pohja, the Swedish name for the Finnish municipality* POJO, abbreviation of Plain Old Java Object in computer programming...

s as models.

Example

A Hello World Wicket application, with four files:

HelloWorld.html
The XHTML template.


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd"
xml:lang="en" lang="en">


Message goes here




HelloWorld.java
The page component that will be bound to the template. It, in turn, binds a child component (the Label component named "message").



package org.wikipedia.wicket;

import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;

public class HelloWorld extends WebPage {
/**
* Constructor
*/
public HelloWorld {
add(new Label("message", "Hello World!"));
}
}


HelloWorldApplication.java
The main application class, which routes requests for the homepage to the HelloWorld page component.


package org.wikipedia.wicket;

import org.apache.wicket.protocol.http.WebApplication;

public class HelloWorldApplication extends WebApplication {
/**
* Constructor.
*/
public HelloWorldApplication {
}

/**
* @see org.apache.wicket.Application#getHomePage
*/
public Class getHomePage {
return HelloWorld.class;
}
}


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 Deployment Descriptor
Deployment Descriptor
A deployment descriptor refers to a configuration file for an artifact that is deployed to some container/engine.In the Java Platform, Enterprise Edition, a deployment descriptor describes how a component, module or application should be deployed...

, which installs Wicket as the default handler for the servlet and arranges for HelloWorldApplication to be instantiated at startup.



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">
Wicket Example

HelloWorldApplication
org.apache.wicket.protocol.http.WicketFilter

applicationClassName
org.wikipedia.wicket.HelloWorldApplication



HelloWorldApplication
/*



Components

  • Basic components like form, links, repeaters, and so on are built-in

http://wicketstuff.org/wicket14/compref/
  • More are on http://wicketstuff.org/confluence/display/STUFFWIKI/Wiki

Releases

Release Date Notes
1.3.7 2009-07-30
1.4 2009-07-30 " ... a departure from the past where we leave Java 1.4 behind and we require Java 5 as the minimum JDK version. By moving to Java 5 as the required minimum platform, we were able to utilize Java 5 idioms and increase the type safety of our APIs."
1.4.1 2009-08-21
1.4.9 2010-05-24 "... over fifteen bug fixes and improvements"
1.4.10 2010-08-11 "... over thirty bug fixes and improvements."
1.4.16 2011-02-25 "This is primarily a minor bugfix release on the 1.4.x (stable) branch."
1.4.17 2011-04-02 "This is primarily a minor bugfix release on the 1.4.x (stable) branch."
1.4.18 2011-08-09 "This is primarily a minor bugfix release on the 1.4.x (stable) branch."
1.4.19 2011-10-19 "This is primarily a minor bugfix release on the 1.4.x (stable) branch."
1.5.0 2011-09-07 "Apache Wicket 1.5 has been in development for the last two years and brings many improvements over previous versions."
1.5.1 2011-09-29 "... over 40 bug fixes and 15 improvements."
1.5.2 2011-10-24 "... over 25 bug fixes and 5 improvements."
1.5.3 2011-11-14 "... over 40 bug fixes and improvements."
1.6 2011-12 (planned) Java 6

See also

  • 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...

  • Click
    Apache Click
    Apache Click is a modern page and component oriented web application framework for the Java language and is built on top of the Java Servlet API....

  • ZK
    ZK (framework)
    ZK is an open-source Ajax Web application framework, written in Java, that enables creation of rich graphical user interfaces for Web applications with no JavaScript and little programming knowledge....

  • Richfaces
    Richfaces
    RichFaces is an open source Ajax-enabled component library for JavaServer Faces, hosted by JBoss. It allows easy integration of Ajax capabilities into enterprise application development.RichFaces is more than just a component library for JavaServer Faces...


Introductory articles



Blogs


Documentation

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