Main Tutorials

Wicket Tutorial

wicket tutorial

Apache Wicket is a simple and features rich component-based web framework, the real reusable components is the main selling point of this framework. However, due to the big different between component-based and MVC architecture, it makes Wicket hard to learn, especially for those classic MVC developers.

In this tutorials, it providing many step by step examples and explanations on using Apache Wicket 1.4.

Basic & Configuration

Wicket hello world, basic stuff and URL configuration.

Model

Wicket model examples, to bind from components to object property, and vise verse.

Form Components

Wicket form component examples.

Validators

Custom validator in Wicket.

Wicket Integration

Integrate Wicket with others.

FAQs

Some common FAQs in Wicket.

Common Errors

Some common error messages in Wicket.

Wicket References

What’s Next?

To study more topics on Wicket frameworks, I recommend below two great Wicket books.

Wicket in Action
Apache Wicket Cookbook

About Author

author image
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

Subscribe
Notify of
19 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
nhlanhla mabasa
8 years ago

Hi, i am new to the wicket and i want to add two tabbed panes in one class and call them in the template page. i want to show this panels in the same screen in wicket. can you help me in this problem thanks in advance

Chaminda
9 years ago

Hi, I am newbie to Wicket. Can you please do a tutorial on Tree structures.
Best if can be done on a Panel, So its easy to reuse.

Thanks,

Yogarajan
1 year ago

Hi,
I am working on the web application that was developed in Java 1.8, Apache wicket 1.5.6 with embedded jetty server 8.1.16 and also developed few pages using Ext JS 3.4.1. Apache 2.4 has configured as reverse proxy for this application.
The problem is after enabling 2 factor authentication(2FA) and trying to upload more than 2 GB file, apache(proxy) server throws exception as Re-negotiation handshake failed, referer:https:///ui/v2FJNs4Lej0jKivA6KUhqg/v2Fd9/Ns48e request body exceeds maximum size (2147483647) for SSL buffer, referer: https:///ui/DXOKJCEAASQaiEwUH_0xOA/DXO6a/ADXe4
Multipart option is enabled for file uploading
httpd.conf:
#Proxy ui to jetty

<Location "/ui">
        ....
        ....
        SSLRenegBufferSize 2147483647

        # Forward the SSL info onto Jetty (GUI)
        RequestHeader set SSL_CLIENT_CERT "%{SSL_CLIENT_CERT}s"
        ....
        ....
     
    ProxyPass http://127.0.0.1:8080/ui
    ProxyPassReverse http://127.0.0.1:8080/ui
</Location>

I am trying with wicket filter to block the request and update Content-Length to 0 before reaching the proxy server. But request is hitting proxy server first and then come to filter. It did not work.
Anybody was facing similar issue?. I may be doing wrong approach. Please help me out to resolve this issue.
I can provide more detail if still requires.

Nisha
1 year ago

Can someone suggest my popup in wicket model is not coming in center bu down’

Bhagat
6 years ago

Hello Mkyong, Can you please help me, i need some documentation or examples related to Apache Wicket Forms where I can navigate between a flow of screens having Text fields, Drop downs, Back and Next button.

I tried a simple example with two screens where i can navigate between the two screens. The issue that i am facing is, I am unable to see the form data that i entered in the first screen on click of “Back” button from my second page and also I am not able to see the data that i entered in second screen on clicking “Next” button from 1st screen.

Puneet Mathur
8 years ago

Love your work! Thanks for the Wicket tutorials.

Have a quick question (very new to Wicket)…I have a web page class which extends a master template which, in turn extends WebPage

I need to call a method in an external library & update value of a label. Is onConfigure() the best place call. Doesn’t seem to be working for me.

public class Processed extends Master{

String loginID = “”;
String tmp = “”;

public Processed(PageParameters pageParams) {
super (pageParams);
loginID = pageParams.getString(“userid”);
add(new Label (“result”, “User id = “” + loginID + “”, Key = ” + tmp ));
}

protected void onConfigure() {
KeyUtils kUtils = new KeyUtils();
tmp = kUtils.doMagic(loginID);
}

}

Help would be appreciated. Thanks.

Keith McNeill
8 years ago

Just a comment on how easy, or otherwise, it is to learn Wicket. If you approach Wicket from the perspective of a Spring MVC, JSF, JSP perspective, it is indeed very different.

However, the difference is that the concept is actually much simpler. Wicket attempts to enfore separation of concerns, therefore (almost) no logic whatsoever in the HTML template. This makes the HTML much more readable, especially from the point of view of a Web Designer. The logic is held within the associated Java class, which could be viewed as the ‘Controller’.

The design of a Wicket application resembles very closely that of a Swing/AWT application, with the added benefit of most of the code for view components not required, as the HTML/CSS takes care of this. Each component can have a ‘model’ object that is automatically updated upon form submit (or value changed) without the need to write any Javascript.

For someone approaching Wicket from a classic Swing Desktop application, it is actually very easy to pick up the concepts behind Wicket. Many of the Widgets even have almost the same name, with the initial letter ‘J’ removed, e.g. TextField instead of JTextField.

Give it a try, you’ll be surprised at how productive you can be in a short period of time.

Farooq Rahu
8 years ago

Hi MkYong, I need an example in wicket for showing please wait dialogue during processing a form submit and form should be locked during submit process.

Steph
8 years ago

last news from wicket https://twitter.com/apache_wicket

http://printable-coloring-pages.net
10 years ago

In all honesty this is a wonderful detailed article nonetheless as with every great authors there are a few items that might be labored after. Yet by no means the actual much less it absolutely was intriguing.

Lakshmi
11 years ago

Please teach me how to create Menu in wicket

Hajo
11 years ago

Nice tutorial. Thanks for some easy to use ideas 🙂

I’m stuck with the problem to display a grid of small pictures (used for a picture based captcha). The pictures are loaded randomly from the database. So I have each of them in a byte[] array and no clue how to display them in some kind of table or grid structure.

Any hint would be highly appreciated!

Best Regards

Hajo

rajeev
11 years ago
i have downloaded wicket sm2w pluglin from source forge but I am not able to install and use it please guide me on this
Arun
11 years ago

Is it possible to do web service composition using wickets??

Arun
11 years ago

is it possibleto do web service composition using wickets

Amir
11 years ago

It sounds Netbeans has some problems with wicket. despite Netbeans Plug-in for wicket I couldn’t integrate wicket1.4 with spring . I try to solve this problem for more than one week .

Anjali
11 years ago

In wicket-Srping MVC integration, can you tell me how to pass the control from wicket page to Spring Controller?

Sudeep Shakya
12 years ago

I have found that “org.apache.wicket.markup.html.resources” package is not available in the wicket-core library in wicket 1.5.3 plugin for netbeans 7.1.1.
Is there any way to add the package????????

Sudeep Shakya
12 years ago

I am using Netbeans 7.1.1 and i have installed Wicket 1.5.3 and I am a beginner. And find wicket easy to learn.
I am having a problem with a package. I used the package org.apache.wicket.markup.html.resources.StyleSheetReference but it is not recognized.