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.
<html> <body> <h2 wicket:id="date"></h2> </body> </html>
That’s it! Deploy it to see the result.
Review
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.



