This page last changed on Mar 15, 2007 by bowens.

Each Wicket app has three parts: the Wicket Application, a wicket page, and the corresponding HTML page.

Wicket acts a bit like GWT in the sense that you define widgets in Java, and the code representing those widgets injects itself into the matching tags in the HTML file.

Lets take a quick look at a simple HelloWorld example from the Wicket website.
The first file is the application. This specifies the entry point of the website: the homepage called HelloWorld.

public class HelloWorldApplication extends WebApplication
    public HelloWorldApplication()
    public Class getHomePage() 
        // our home page (the entry point)
        return HelloWorld.class;

The second thing we need to create is the home page written in Java using Wicket:

public class HelloWorld extends WebPage
    public HelloWorld()
        add(new Label("message", "Hello World!"));

This page will create a Label, with the ID "message", and set the value of the label to be "Hello World!".
What this does is it will make Wicket look for an HTML element with the ID "message", and then it will inject the label in that element.

The last thing that is needed is the HTML page that goes with the HelloWorld wep page we just created:

    <span wicket:id="message">Anything in here gets replaced</span>


Wicket has a decent set of widgets you can use. To name a few:

  • Button
  • Text field
  • Radio button
  • Panel
  • Form
  • Image
  • Link
  • ...

These are all used the same way that the above HelloWorld example used the Label widget: each one has an ID that needs to match an ID in the HTML file.


Widgets, suchs as forms, have an onSubmit() method that will take in the input from the form, and allow you to use the data as you wish. Here is a quick example of a form from the Wicket home page:

public final class GuestBook extends WebPage
	/** Use a Vector, as it is synchronized. */
	private static final List commentList = new Vector();
	private final ListView commentListView;

	public GuestBook()
		add(new CommentForm("commentForm"));
		add(commentListView = new ListView("comments", commentList)
			public void populateItem(final ListItem listItem)
				final Comment comment = (Comment)listItem.getModelObject();
				listItem.add(new Label("date",;
				listItem.add(new MultiLineLabel("text", comment.text));

	public final class CommentForm extends Form
		private final Comment comment = new Comment();

		public CommentForm(final String componentName)
			add(new TextArea("text", new PropertyModel(comment, "text")));

		public final void onSubmit()
			final Comment newComment = new Comment();
			newComment.text = comment.text;

			commentList.add(0, newComment);

			comment.text = "";

You can grab the servlet context from the WebApplication, and from there get the GeoServer configuration so you can manipulate it.

Document generated by Confluence on May 14, 2014 23:00