Wicket 7 Debug Bar Empty? Add a DebugBarInitializer to your app.

In Wicket 7.12.0, adding a DebugBar to your page will result in an empty / useless debug bar if you don’t add a DebugBarInitializer to your app. Hopefully this will be documented by the wicket project in the future, but it isn’t right now.

Add the DebugBarInitializer to your wicket Application class like so:

public class MyApplication extends AuthenticatedWebApplication {		
  protected void init() {
    new DebugBarInitializer().init(this);

    //it's also helpful to turn these other debug settings on
    DebugSettings ds = getDebugSettings();
    ds.setAjaxDebugModeEnabled(true);
    ds.setComponentPathAttributeName("debugComponentPath");
    ds.setDevelopmentUtilitiesEnabled(true);				
    ds.setLinePreciseReportingOnAddComponentEnabled(true);
    ds.setLinePreciseReportingOnNewComponentEnabled(true);
  }
}

The code snippet above also references other common DebugSettings options in Wicket.

And, for quick reference, add the DebugBar to your WebPage class like this:

public class Page extends WebPage implements ViewUpdater {
  protected void onInitialize() {
    super.onInitialize();				
    add(new DebugBar("debugBar"));
  }		
}

Then, for the page’s html, you’d do something like this:

<!DOCTYPE html>
<html>
  <body>
    <div wicket:id='debugBar'></div>
    <p>Hello world!</p>
  </body>
</html>