Wicket in Action

Wicket HTML validator 1.2

09 June 2009, by dashorst

I just performed the 1.2 release of WicketStuff HTML Validator, thanks to Emond Papegaaij, a Topicus Onderwijs co-worker. This new release adds the ability to ignore Wicket specific bugs when using the & entity in JavaScript calls, and adds the ability to ignore <input type="text" autocomplete="false" /> validation errors. Even though you specify that your document is (X)HTML compliant, browsers will (fortunately) still work with these validation errors present.

The markup validator was featured in my presentation "Get your Wicket Application in production (and keep your weekends free)". The validator will notify you if you have invalid HTML markup in your rendered pages. While usually not destructive, having invalid markup can result in long debugging errors when replacing part of your page with for example Ajax, or traversing the DOM.

You can use it by adding the HtmlValidationResponseFilter to the Wicket
request cycle filters in the following fashion:

public class MyApplication extends WebApplication {
    // ...

    protected void init() {
        // only enable the markup filter in DEVELOPMENT mode
        if(DEVELOPMENT.equals(getConfigurationType())) {
            HtmlValidationResponseFilter htmlvalidator = 
                              new HtmlValidationResponseFilter();

And you’re all set. Make sure you define a XHTML doctype in your pages, such

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="http://www.w3.org/1999/xhtml">

To use the HtmlValidator, include the following in your project’s pom:


You might need to add the Wicket Stuff maven repository to your repository list.