How to Create and Deploy a Wicket Application with a Zipper, Text Editor and Javac

Kategorilenmemiş, ytulinux

Today we ll try something weird: creating a WAR application with most primitive conditions. We should have a zipper (Gzip or WinZip will be enough), a text editor, and of course the javac compiler itself.

First we should create a directory named MinimumTools. Create two directories which are named “src” and “build”.

We should first create the hello world files. What do we need? We need a java class named MinimumToolsApplication which  represents our core code. We will only override its “getHomePage” function so we will be able to return our home page’s class, MinimumToolsPage (which will reside in

import org.apache.wicket.protocol.http.WebApplication;

public class MinimumToolsApplication extends WebApplication {
public MinimumToolsApplication () {

public Class<MinimumToolsPage> getHomePage() {
return MinimumToolsPage.class;

import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;

public class MinimumToolsPage extends WebPage {

public MinimumToolsPage () {
add(new Label("say","Greetings sire"));

Wicket will instantiate a MinimumToolsPage with reflection, so we should be sure that we implemented a public constructor to MinimumToolsPage class.

Each WebPage subclass has an html that is used with itself, so creating an html file named MinimumToolsPage.html would be wisely 😉


<span wicket:id="say">here comes your message</span>

And we also need a configuration file named web.xml, it will include the url pattern and filter for it. We will use “/”, so “http://localhost:port/${app_name}/” (app_name is “MinimumTools” here) will trigger our MinimumToolsPage class.

<display-name>This is Madness</display-name>
Now we have everything except wicket.jar and slf4j.jar (Yes we cant work without libraries)
Get Slf4j-api-version.jar (extract the API not the other one, or it wont work):
Now we can create the war file. First, create a directory named “WEB-INF” under build directory. Create directories named “lib”, “classes” inside “WEB-INF”.
Put web.xml to “WEB-INF“.
Put the jar files to “lib” under “WEB-INF“.
Go to to src, there should be your java classes and your html. Copy the wicket jar here too (to use it for compilation stage). Run

javac -cp wicket-version.jar;.

(If you get warning, you can add parameter “-Xlint“, if you compile classes on a linux machine, use “:” instead of “;” for seperating paths)
Copy the “.class” files and the html to “build/WEB-INF/classes
Now zip the content of build, (its content, not the build directory itself) rename it to MinimumTools.war (Actually its a zip file) and deploy it to your favourite application server. If you dont have an application server, try Jetty ), download and extract it to a directory, put the war file into webapps directory which is under Jetty‘s root directory. run

java -jar start.jar

At its root directory.
Use the browser and open “http://localhost:port/${app_name}/”  (which should be “http://localhost/8080/MinimumTools/” for Jetty)
Congratulations! :)
But keep in mind, always use ant file+eclipse for real projects :))

Bu yazı toplamda 3299, bugün ise 0 kez görüntülenmiş

  • Yasin Bahtiyar

    Or just use maven:

    $ mvn archetype:generate -DarchetypeArtifactId=wicket-archetype-quickstart -DarchetypeGroupId=org.apache.wicket
    $ mvn jetty:run

  • huseyinalb

    just started reading a maven tutorial, i liked the dependency thing, it feels more like “package” programming.
    but using maven is difficult if your co-workers dont use that. no one will want to continue supporting a package if it contains a tool that he/she is not used to. And no one will care your requirements saying “we didnt tell you to use that” and they will be right i guess :)