Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Apache Wicket

From Wikipedia, the free encyclopedia
Software
Apache Wicket
DeveloperApache Software Foundation
Stable release
10.5.0[1] Edit this on Wikidata / 2025-04; 7 months ago
Repositorygithub.com/apache/wicket
Written inJava
TypeWeb application framework
LicenseApache License 2.0
Websitewicket.apache.org

Apache Wicket, commonly referred to asWicket, is a component-basedweb application framework for theJava programming language conceptually similar toJavaServer Faces andTapestry. It was originally written by Jonathan Locke in April 2004. Version 1.0 was released in June 2005. It graduated into anApache top-level project in June 2007.[2]

Rationale

[edit]

Traditionalmodel-view-controller (MVC) frameworks work in terms of wholerequests and whole pages. In each request cycle, the incoming request is mapped to a method on acontroller object, which then generates the outgoing response in its entirety, usually by pulling data out of amodel to populate aview written in specializedtemplate markup. This keeps the application'sflow-of-control simple and clear, but can makecode reuse in the controller difficult.

In contrast, Wicket is closely patterned afterstatefulGUI frameworks such asSwing. Wicket applications are trees ofcomponents, which use listenerdelegates to react toHTTP 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.

Design

[edit]

Wicket uses plainXHTML for templating (which enforces a clear separation of presentation andbusiness logic and allows templates to be edited with conventionalWYSIWYG design tools[3]). Each component is bound to a named element in the XHTML and becomes responsible for rendering that element in the final output. Thepage is simply the top-level containing component and is paired with exactly one XHTML template. Using a special tag, a group of individual components may be abstracted into a single component called apanel, which can then be reused whole in that page, other pages, or even other panels.

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 asopaque objects automaticallyserialized andpersisted between requests. More complex models, however, may be madedetachable and providehooks to arrange their own storage and restoration at the beginning and end of each request cycle. Wicket does not mandate any particular object-persistence orORM layer, so applications often use some combination ofHibernate objects[citation needed],EJBs orPOJOs as models.

In Wicket, all server side state is automatically managed. You should never directly use an HttpSession object or similar wrapper to store state. Instead, state is associated with components. Each server-side page component holds a nested hierarchy of stateful components, where each component's model is, in the end, a POJO (Plain Old Java Object)

Wicket aims for simplicity. There are no configuration files to learn in Wicket. Wicket is a simple class library with a consistent approach to component structure.

Example

[edit]

AHello World Wicket application, with four files:

HelloWorld.html
The XHTML template.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd"xml:lang="en"lang="en"><body><spanwicket:id="message"id="message">Messagegoeshere</span></body></html>
HelloWorld.java
The page component that will be bound to the template. It, in turn, binds a child component (the Label component named "message").
packageorg.wikipedia.wicket;importorg.apache.wicket.markup.html.WebPage;importorg.apache.wicket.markup.html.basic.Label;publicclassHelloWorldextendsWebPage{/**     * Constructor     */publicHelloWorld(){add(newLabel("message","Hello World!"));}}
HelloWorldApplication.java
The main application class, which routes requests for the homepage to the HelloWorld page component.
packageorg.wikipedia.wicket;importorg.apache.wicket.protocol.http.WebApplication;publicclassHelloWorldApplicationextendsWebApplication{/**     * Constructor.     */publicHelloWorldApplication(){}/**     * @see org.apache.wicket.Application#getHomePage()     */publicClassgetHomePage(){returnHelloWorld.class;}}
web.xml
Theservlet applicationDeployment Descriptor, which installs Wicket as the default handler for the servlet and arranges for HelloWorldApplication to be instantiated at startup.
<?xml version="1.0" encoding="UTF-8"?><web-appxmlns: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>WicketExample</display-name><filter><filter-name>HelloWorldApplication</filter-name><filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class><init-param><param-name>applicationClassName</param-name><param-value>org.wikipedia.wicket.HelloWorldApplication</param-value></init-param></filter><filter-mapping><filter-name>HelloWorldApplication</filter-name><url-pattern>/*</url-pattern></filter-mapping></web-app>

Components

[edit]

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

Releases

[edit]
Apache Wicket Versions
SeriesDescriptionLatest releaseLatest release date
Latest version:10.xMigrated from Javax APIs to Jakarta APIs. Dependencies upgraded to support Spring Framework 6 and therefore moving to Java 17 as the required minimum platform, and compatible with Java 21. CGLib is replaced with ByteBuddy.[4]10.0.02024-03-11
Latest version:9.xMoving to Java 11 as the required minimum platform, migrated from JUnit 4 to 5, support for Java 12 and 13, rework page and data storage and other improvements.[5]9.16.02023-11-23
Supported: 8.xMoving to Java 8 as the required minimum platform. Support for Lambdas, required Servlet API version moving to 3.1, support for the new types for handling dates and other improvements.[6] Recommended to upgrade to 9.x version.8.14.02022-01-29
Supported: 7.xMoving to Java 7 as the required minimum platform, cross site request forgery prevention, support for inline images. The release consist of almost 300 features, improvements and fixes.[7] Only security fixes, recommended to upgrade to 9.x version.7.18.02021-04-02
Unsupported: 6.xMoving to Java 6 as the required minimum platform. Out-of-the box jQuery integration, complete control over AJAX requests, improved event registration in browsers, support for large datasets, dependency management for client side JavaScript libraries, experimental support for websockets.[8]6.30.02018-12-05
Unsupported: 1.5.xImprovements of the Wicket features.[9]1.5.162016-08-05
Unsupported: 1.4.xMoving to Java 5 as the required minimum platform.[10]1.4.232014-02-06
Unsupported: 1.3.x1.3.72009-07-30
Unsupported: 1.2.x1.2.72008-03-23
Unsupported: 1.1.x1.1.1TBD
Unsupported: 1.0.x1.0.3TBD
Legend:
Unsupported
Supported
Latest version
Preview version
Future version

See also

[edit]

References

[edit]

Notes

[edit]
  1. ^https://github.com/apache/wicket/blob/master/CHANGELOG-10.x. Retrieved7 May 2025.{{cite web}}:Missing or empty|title= (help)
  2. ^Dashorst, Martijn (2007-07-20)."Wicket graduates from Apache Incubation". Retrieved2008-03-07.
  3. ^Carleton, Daniel (2007-10-12)."Java Web Development the Wicket Way". DevX.Archived from the original on 10 March 2008. Retrieved2008-03-07.
  4. ^Announcing Apache Wicket 10: build modern web applications with Java!. wicket.apache.org. Retrieved on 2024-03-11.
  5. ^Announcing Apache Wicket 9: get into the modern Java world!. wicket.apache.org. Retrieved on 2020-10-05.
  6. ^Announcing Apache Wicket 8: Write Less, Achieve More. wicket.apache.org. Retrieved on 2018-05-22.
  7. ^Apache Wicket v7.0 released. wicket.apache.org. Retrieved on 2018-04-16.
  8. ^Apache Wicket v6.0.0 released. wicket.apache.org. Retrieved on 2020-10-05.
  9. ^Apache Wicket - Apache Wicket releases Wicket 1.5. Wicket.apache.org. Retrieved on 2013-08-13.Archived October 6, 2014, at theWayback Machine
  10. ^Apache Wicket - Apache Wicket 1.4 takes typesafety to the next levelArchived April 25, 2012, at theWayback Machine. Wicket.apache.org. Retrieved on 2013-08-13.

External links

[edit]

Official websiteEdit this at Wikidata

Top-level
projects
Commons
Incubator
Other projects
Attic
Licenses
.NET
C++
ColdFusion
Common Lisp
Haskell
Java
JavaScript
Perl
PHP
Python
Ruby
Rust
Scala
Smalltalk
Other languages
Authority control databasesEdit this at Wikidata
Retrieved from "https://en.wikipedia.org/w/index.php?title=Apache_Wicket&oldid=1278572943"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp