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 :

  • Apache Wicket 1.4.17
  • Eclipse 3.6
  • 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.
How to setup Wicket Examples in Eclipse

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“.
    How to setup Wicket Examples in Eclipse

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

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/

How to setup Wicket Examples in Eclipse

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

相关文章: