Hello World of Wicket Framwork:


Step1: Create a new Maven Wicket project having the following hierarchy.

image1

Step-2 Add Wicket and SLFJ dependencies in POM.xml file as follows.
4.0.0
com.mkyong.core
WicketExamples
war
1.0-SNAPSHOT
WicketExamples
http://maven.apache.org
org.apache.wicket
wicket
1.4.17


org.slf4j
slf4j-log4j12
1.5.6

WicketExamples
true
org.apache.maven.plugins
maven-compiler-plugin
1.6
true

Step -3 Create the deployement descriptor having the WicketFilter like as follows and specify your
WebApplication class as init param

Wicket Web Application
wicket.wicketTest
org.apache.wicket.protocol.http.WicketFilter

applicationClassName com.mkyong.MyApplication
wicket.wicketTest
/*

Step-4 Create MyApplication class which extends WebApplication and override getHomePage() method

package com.mkyong;
import org.apache.wicket.Page;
import org.apache.wicket.protocol.http.WebApplication;
import com.mkyong.hello.Hello;
public class MyApplication extends WebApplication {
@Override
public Class<? extends Page> getHomePage() {
return Hello.class; //return default page
}
}

Step-5 Create a new web page class which extends WebPage class

package com.mkyong.hello;
import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.model.Model;
public class Hello extends WebPage {
private static final long serialVersionUID = 1L;
public Hello(final PageParameters parameters) {
add(new Label("message", new Model("Hello World, Wicket")));
}}

Step -6 Create the html page parallel to the java class named hello.html

Wicket Hello World

message will be replace later

This wicket id should me mapped with label id.
Step-7 Run the application
image2

This entry was posted in Wicket Framework and tagged on by .
Rahul Thakur

About Rahul Thakur

Hi, this is Rahul working as Software Engineer at Orange Business Services. Responsible for Requirement analysis, design ,development, deployment, and testing. Working on Agile methodology and Scrum Experience on UML, OOAD, OOPS, Design patterns, Java / J2ee technologies, ORM, performance and load tests, code review and lot of SDLC activities.