Build web applications from Java components and plain HTML
Apache Wicket is a component-oriented Java web framework, open source since 2004 and a project of the Apache Software Foundation since 2007. Every component keeps its behaviour and state in Java and its markup in plain HTML, so there is no JavaScript build chain to maintain.
| Release line | Supported until |
|---|---|
| Wicket 10 LTS | Jul 2027 |
| Wicket 11 | Jan 2027 |
Just endedWicket 9Wicket 8 Upgrade paths
From the blog
-
Apache Wicket 11.0.0 released
The Apache Wicket PMC is proud to announce Apache Wicket 11.0.0! Wicket 11 opens the quarterly release schedule. It moves to a current Java and Jakarta baseline, tightens... -
Wicket 8 and 9 have reached end of life
With their final releases 9.25.0 and 8.20.0, Wicket 9 and 8 have reached end of life, and with them Wicket's support for javax.servlet. Move to Wicket 10 LTS, supported until July 2027, or to Wicket 11. -
A new release cadence for Apache Wicket
Starting with Apache Wicket 11.0, due in the first week of October 2026, Wicket moves to time-based releases: a new major release every three months, and an LTS...
Why Wicket
-
A page is a Java class and an HTML file
Use what you know about Java and your favourite HTML editor. Behaviour lives in Java, markup stays plain HTML, and no JavaScript build is needed.
- The
wicket:idjoins each tag to the Java component with the same id. The HTML stays plain HTML that any editor opens. - A click runs
onClick()on the server, and Wicket renders the page again. - The field
clickskeeps its value between requests, because Wicket keeps the page object for you. - A part you reuse on many pages is a
Panel: again a Java class and an HTML file. Components and markup shows how.
HomePage.java
public class HomePage extends WebPage { private int clicks; public HomePage() { add(new Link<Void>("count") { @Override public void onClick() { clicks++; } }); add(new Label("clicks", () -> clicks)); } }HomePage.html
<p> You clicked <span wicket:id="clicks">0</span> times. <a wicket:id="count">Click me</a> </p> - The
-
Components for complex pages
Pages and components are real Java objects with encapsulation, inheritance and events. Build a panel once and use it on every page, and bundle a component with its stylesheets, JavaScript and other resources into one reusable package.
AddressPanel.java
public class AddressPanel extends Panel { public AddressPanel(String id, IModel<Address> address) { super(id, new CompoundPropertyModel<>(address)); add(new TextField<String>("street")); add(new TextField<String>("city")); } } // one component, used twice on the same form form.add(new AddressPanel("billing", billingAddress)); form.add(new AddressPanel("shipping", shippingAddress)); -
Ajax without writing JavaScript
Update selected parts of a page from Java, without a single line of JavaScript. An Ajax request re-renders only the components you add to it, and Wicket comes with a large set of ready-made Ajax components.
CounterPage.java
Label count = new Label("count", () -> clicks); add(count.setOutputMarkupId(true)); add(new AjaxLink<Void>("increment") { @Override public void onClick(AjaxRequestTarget target) { clicks++; target.add(count); } }); -
Secure by default
URLs do not expose sensitive information and component paths are session-relative. Wicket supports a Content Security Policy without
unsafe-inline: it adds a nonce to every header contribution itself, and you add only the sources your application needs. Configure the Content Security Policy shows how.MyApplication.java
@Override protected void init() { super.init(); // the default policy allows images from your own origin; // allow one extra image host getCspSettings().blocking() .add(CSPDirective.IMG_SRC, "https://images.example.com"); } -
Tested without a browser
WicketTester renders your pages and components in a unit test, without a browser or a container, and checks their markup, attributes and contents. It clicks links and submits forms as a visitor would.
HomePageTest.java
WicketTester tester = new WicketTester(new MyApplication()); tester.startPage(HomePage.class); tester.assertLabel("clicks", "0"); tester.clickLink("count"); tester.assertLabel("clicks", "1");
Also included
- Translations in over 25 languages
- Safe use of multiple tabs and windows
- Injection with CDI, Spring and Guice
- Jakarta EE integration
- Component-local JavaScript and CSS
Coming from Spring MVC, Jakarta Faces or Vaadin? Why component-oriented compares Wicket with request-based and other component frameworks, what it gains and what it costs, and the glossary gives each Wicket term with what other frameworks call it.
Built with Wicket
Many applications run on Wicket without saying so. These say so, collected through the Built with Wicket feed. Submit your own project.
Learn Wicket in five lessons
The lessons build one application, from an empty project to a tested page with Ajax.
Built by the people who use it
Apache Wicket is developed in the open by volunteers. Answer a question on the users list, report a bug with a quickstart, improve the documentation, or send a pull request to apache/wicket: a committer reviews it, and it goes out with the next release of its line.