How to setup Wicket Examples in Eclipse

Wicket examples is a good place to learn Apache Wicket by examples, and a must reference site for new or experienced Wicket’s developers. In this Wicket examples site, it almost contains all of the usage of the common wicket’s components.

In this guide, we show you how to setup the above Apache Wicket example site in your local development environment (Eclipse IDE).

Tools used :

  1. Apache Wicket 1.4.17
  2. Eclipse 3.6
  3. Maven 3

1. Download Source Code

Download Apache Wicket 1.4.17 from http://wicket.apache.org/. The Wicket example code is packaged inside the “src” folder.

2. Review Directory

Extracts the downloaded Wicket zip file, review the directory structure. The folder “wicket-examples“, which inside the “$WICKET_PATH/src” folder is what you need.

wicket example folder structure

3. Maven Build

Navigate to the “wicket-examples” folder , compile and build with Maven, and make it support Eclipse WTP features.

$WICKET_EXAMPLE_FILE_PATH> mvn eclipse:eclipse -Dwtpversion=2.0

P.S Maven will configure the project and download the project dependencies automatically.

4. Eclipse Project + WTP

Import the project into Eclipse IDE (you should know how :)).

However, in Wicket 1.4.17, the Maven “-Dwtpversion=2.0” option seem not working in my Eclipse 3.6, because i noticed Eclipse facets files and deployment dependency libraries are not configure properly. If you have the same problem, do following steps :

1. Right click on project –> Properties –> “Project Facets“. Select “Dynamic Web Module” and “Java“.

wicket example eclipse facets

2. Same windows –> Select “Deployment Assembly“, make sure the libraries and root deploy path “/” are configured properly. Just add it if it’s missing.

wicket example eclipse depoyment dependency

5. Deploy + Test

In Eclipse IDE, create a Tomcat instance, assigned your configured “wicket-example” project to the new Tomcat instance and start it.

Visit this URL : http://localhost:8080/wicket-examples/

wicket example cloned site

Done. The entire wicket examples site is cloned into your local development environment.

About the Author

author image
mkyong
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

avatar
10 Comment threads
15 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
12 Comment authors
the canhJim CallanArunWicket TutorialFilip Recent comment authors
newest oldest most voted
Jim Callan
Guest
Jim Callan

I have been putzing around for two days… I would work a bit on Wicket and have it run fine from Jetty in all the unit tests, run with the standard default mvn tomcat:run with the default 8080 pluging but could not get any Wicket example to run on on my Tomcat 7 server configured on port 2013 within Eclipse. I would download something new, rebuild and get the same effect regardless of the project. I would take a break and come back to the same thing. Very frustrating…until I saw this Wiki post. In 30 seconds I had it… Read more »

trackback
Wicket Tutorial

[…] Hello World Example A simple hello world to explore the basic structure of Wicket web application. Setup Wicket examples in local enviroment Setup a cloned Wicket example site in your local development environment for quick reference. […]

Filip
Guest
Filip

This is how my Deployment assembly looks like:

http://dl.dropbox.com/u/8189835/deploymentassembly.jpg

Is there anything missing here?

I keep getting the same error. It worked with the Jetty server, as you suggested, but I would like to run wicket-examples in the Tomcat server in Eclipse.

Diego Amicabile
Guest
Diego Amicabile

Doesn’t work for me, I get this exception when trying to start Tomcat (Wicket-examples 1.4 and Tomcat 7)

INFO  - ContextLoader              - Root WebApplicationContext: initialization started
...
Caused by: java.lang.ClassNotFoundException: org.apache.wicket.spring.common.ContactDaoImpl
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1672)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1517)
	at org.springframework.util.ClassUtils.forName(ClassUtils.java:211)
	at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:385)
	at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1138)
	... 29 more
Nov 22, 2010 11:53:04 AM org.apache.catalina.core.StandardContext listenerStart
Diego Amicabile
Guest
Diego Amicabile

I found a solution, it worked when I skipped step 4 and built the project from the downloaded archive, without first moving it.
The pom.xml in the wicket-examples directory is dependent on the pom.xml in the parent directory, so you just cannot move it somewhere else and expect it to work.

the canh
Guest
the canh

Try build the project again using eclipse.

green
Guest
green

Hi..

i’m new wicket user. I would like to ask your advise about the windows model. I found out the when windows model popup. The current main page at backgroup are disabled. Due to the user requirement, how to i allow the current page at backgroup are allow to edit. Because not very page we must be disabled. Thanks

Green

René
Guest
René

Thank you very much, this article helped me a lot!!!!

javi
Guest
javi

hello, how are you friend, i follow the steps for developing the application but it shows a server error, I could help, the error that showed me tomcat is:

HTTP Status 404 – / wicket-examples /

————————————————– ——————————

type Status report

Message / wicket-examples /

Desc The requested resource (/ wicket-examples /) is not available esti ¿½.

Kent Larsson
Guest
Kent Larsson

Excellent article! It got me going even though I use Linux and wanted Wicket 1.3.5. Thanks a lot! (Please keep it up, it’s one of the few resources with this information.)

Tommy Stenberg
Guest
Tommy Stenberg

Thank you !
This is the only place I have found telling how to get everything with wicket including the examples to work. “How difficult can it BE!!”
/Tommy

trackback
Wicket Hello World Example with Maven - Tutorial | wicket

[…] Please set up a wicket example to explore more about wicket usage.How do setup Wicket Examples in Eclipse […]