Chapter 4: First Miracle - Your first prayer in code

Hello Page

Create a page class, pair it with markup, and add a Label. This is the first Wicket act: rendering server-side components into clean HTML.

HomePage.java
public class HomePage extends WebPage {
  public HomePage() {
    add(new Label("message", "Hello, Wicket Scripture!"));
  }
}

Counter

Add a Link and increment a field in onClick(). You now have behavior, state, and rerendered output under direct Java control.

State Persistence

Because Wicket keeps page state on the server, values can persist naturally between requests. Use this power intentionally, and avoid storing heavy objects without need.