What is Apache Wicket ?
Apache Wicket is a Web Framework provided by Apache Foundation “apache.org“.
Why Apache Wicket?
To my understanding, Apache wicket is a Component based web framework. Which provides support to create the View and Model (UI and Business Logic) very quickly and easily.
What do we need to create Wicket Application?
In order for us to build Wicket Application, we need the Libraries and IDEs.
- Wicket Libraries – Download (at the time of writing this blog i used the Apache Wicket 7.x)
- Eclipse IDE J2EE/WDT – Download
- m2e – maven2 for Eclipse Plugin – How to download m2e from market place?
- Tomcat 7 (We need a web server, to run our application to handle the Servlet/Filter Request & Response)
Note: If you are using maven to configure the project, you do not need to download the wicket libraries mentioned above, because maven will download the necessary jars required for Wicket Application.
Lets Get Start With Setting up the Workspace!!
- Launch Eclipse
- Create New Dynamic Web Project (New -> Project -> Other – Dynamic Web Project)
- Give Project a Name “WicketHelloWorld”
- Choose the Runtime and Select Apache Tomcat 7.0 (How to Setup Apache Tomcat 7 Server)
- Click Next
New Dynamic Web Project
- Do not change anything for the class source directory, Click Next
No Changes, Click next
- Make Sure you Click the Check Box “Generate web.xml”. !
Select Generate web.xml
- Click Finish.
- Your project will be created and can be seen in project explorer.
Adding Maven Dependency to the Project we created.
- We need to add Maven Dependency to the project.
- Right Click on the Project and Choose “Configure -> Convert to Maven Project”.
Groupid : your package name can be given Artifact id: Your Project Name packaging: war (Web archive)
- Click Finish, pom file will be opened.

pom.xml
- We need to add the dependency for Wicket and other required libraries.
- Click on the pom.xml tab and add the below dependency entry
org.apache.wicket wicket 7.7.0 pomadd this into pom.xml after closing tag. and save the pom.
- Press Alt+F5 to update the Maven dependency
Note: You need Internet connection at very first to download the wicket library files.
- Once your have the maven dependency downloaded, we are good to start creating our Wicket Hello World!! Program.
- Open web.xml from WebContent/WEB-INF/web.xml
WicketHelloWorld WicketFlowApp org.apache.wicket.protocol.http.WicketFilter applicationClassName in.co.aryanz.app.MainApplication WicketFlowApp /*We have to add Filter to the web.xml, so that when we hit the URL in browser it uses the wicket filter to kick-start our application.
- Now create new java package “in.balamt.app”
- Create new Java Class “MainApplication.java” which extends from “org.apache.wicket.protocol.http.WebApplication”.
package in.balamt.app; import org.apache.wicket.Page; import org.apache.wicket.protocol.http.WebApplication; public class MainApplication extends WebApplication { @Override public Class getHomePage() { // This getHomePage method will be called at first, and inorder to have our HomePage to be displayed we give the HomePage.class return HomePage.class; } }MainApplication.java
- getHomePage() method is called when launching the application. so we have to provide the home page.
- Create new package “in.balamt.pages”
- Create New Java Class “HomePage.java” and Create New HTML “HomePage.html”
Note: Wicket required both java and html files, also both the files need to be placed together, meaning java and html file name and location should be same.
To be continued