Write Less, Achieve More
Download now »
 

Announcing Apache Wicket 8: Write Less, Achieve More

The Apache Wicket project announces the 8th major release of the open source Java web framework servicing websites and applications across the globe for over a decade. With this release Wicket embraces Java 8 idioms fully, allowing the use of lambda expressions in all the right places. With Wicket 8 you can write fewer, faster and more maintainable code.

A Careful Application of Java 8

While previous versions of Wicket work well with Java 8 and beyond, the Wicket API was not optimized to make full use of Java 8 idioms. After careful consideration and trying many paths to adopt new ways of combining Java 8 and Wicket, we finally settled on the current API.

Java 8’s new idioms and types have been applied throughout Wicket’s API. Learn more about the details below.

Lambdas in All The Right Places

The major feature of Java 8 was the addition of lambda support in the language. With Wicket 8 we have looked at providing lambda support in the API and have weighed it against performance and memory usage considerations.

In this light we have opted to continue using subclassing as the primary extension mechanism for Wicket components. Factories for lambdas have been provided for various forms of models (databinding) and behaviors (adapters for components).

Optional is Somtimes Required

// WICKET 7:
add(new AjaxFallbackLink<Void>("wicket7") {
    @Override
    public void onClick(AjaxRequestTarget target) {
        if(target != null) {
            // ...
        }
    }
});
// WICKET 8:
add(new AjaxFallbackLink<Void>("wicket8") {
    @Override
    public void onClick(Optional<AjaxRequestTarget> target) {
        if(target.isPresent()) {
            // ...
        }
    }
});

Models as Functional Interface

Wicket uses models as the databinding method: each data-aware component can take a model implementation to retrieve and store data in. From Wicket 8 we have made the root interface IModel a functional interface. You can now use lambdas where you can use models.

The following example binds a Label component to the name of a person object in different ways using Wicket 8:

add(new Label("name1", person::name));
add(new Label("name2", () -> person.getName()));
add(new Label("name3", LambdaModel.of(personModel, Person::getName)));
add(new Label("name4",
  LambdaModel.of(contractModel, Contract::getPerson)
    .map(Person::getName)));

The new LambdaModel type in Wicket enables type safe, refactor safe databinding for components. Previously one would bind data to components using PropertyModel, using a string expression to determine the exact property to show. The string expression is something like "person.name". This is inherently difficult to refactor when you decide to change the name field into for example "lastName". With LambdaModel, this refactoring is trivial for IDEs to perform: the Java methods can easily be renamed and the IDE will find all the references.

Microbenchmarks have shown that using lambda models provides much better performance than the string based PropertyModel at the cost of slightly larger memory footprint.

No Rewrite Necessary

The Wicket team has been very careful of adopting Java 8 technologies and as such you don’t have to rewrite your whole application, whilst still reaping all the benefits of Java 8.

As this is a new major version we have, in accordance with semantic versioning, cleaned up many APIs and you will get compile errors when you migrate from previous Wicket versions.

Migrating to Wicket 8

When you migrate from a previous Wicket version to Wicket 8, a full list of changes and migrations is available at the following page:

https://s.apache.org/wicket8migrate

Please consult this migration guide when you are moving towards Wicket 8.

Getting Started with Wicket 8

It is very easy to get started with Wicket: use our quick-start wizard or use one of the options below.

Download using Apache Maven

With Apache Maven update your dependency to (and don't forget to update any other dependencies on Wicket projects to the same version):

<dependency>
    <groupId>org.apache.wicket</groupId>
    <artifactId>wicket-core</artifactId>
    <version>8.0.0</version>
</dependency>

Download sources/binaries manually

Or download and build the distribution yourself, or use our convenience binary package


Introducing Apache Wicket

Invented in 2004, Wicket is one of the few survivors of the Java serverside web framework wars of the mid 2000's. Wicket is an open source, component oriented, serverside, Java web application framework. With a history of over a decade, it is still going strong and has a solid future ahead. Learn why you should consider Wicket for your next web application.

Work with JavaScript and CSS

Global JavaScript libraries and CSS styling mix properly with component local JavaScript and CSS resources. You can use custom component libraries that ship with default JavaScript behaviour and CSS styling, without having to do anything yourself. Creating such self-contained component libraries is as easy as creating a JAR file.

Projects Using Apache Wicket

Many projects use Wicket but are not known for it. Below you find a list of projects that are Powered by Wicket.



This list is generated from our Tumblr feed 'Built with Wicket'. You can submit your own project to this list through this form.

News about Apache Wicket

Get the latest updates to releases, security bulletins, community news and more.

Announcing Apache Wicket 8: Write Less, Achieve More

22 May 2018

The Apache Wicket project announces the 8th major release of the open source Java web framework servicing websites and applications across the globe for over a decade. With this release Wicket embraces Java 8 idioms fully, allowing the use of lambda expressions in all the right places. With Wicket 8 you can write fewer, faster and more maintainable code.

Read more...

Apache Wicket 6.29.0 released

21 Feb 2018

The Apache Wicket PMC is proud to announce Apache Wicket 6.29.0!

Apache Wicket is an open source Java component oriented web application framework that powers thousands of web applications and web sites for governments, stores, universities, cities, banks, email providers, and more. You can find more about Apache Wicket at https://wicket.apache.org

This release marks another minor release of Wicket 6. We use semantic versioning for the development of Wicket, and as such no API breaks are present breaks are present in this release compared to 6.0.0.

Using this release

With Apache Maven update your dependency to (and don’t forget to update any other dependencies on Wicket projects to the same version):

<dependency>
    <groupId>org.apache.wicket</groupId>
    <artifactId>wicket-core</artifactId>
    <version>6.29.0</version>
</dependency>

Or download and build the distribution yourself, or use our convenience binary package

Read more...