Wicket 4: Make a page in Eclipse

This is part 4 of a series about Wicket. For setup see part 1.

Let’s see how easy is to create a wicket page in Eclipse.

We’d like a simple page that shows the current date and time:

package nikos;

import java.util.Date;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;

public class MyDate extends WebPage {
   public MyDate() {
      add(new Label("date", new Date().toString()));

To create the HTML right-click on the project → New → Other… → Web → HTML

In the “New HTML Page” dialog give the name MyDate.html, open the src directory and select the package name.

This is some sample markup.

      <h2 wicket:id="date"></h2>

That’s it! Deploy it to see the result.


In Eclipse we place the .html file in the same folder with the .java file.

Then, during deployment, Eclipse automatically bundles the HTML file in it’s proper position: along with the class file.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: