JQuery jGrowl with Wicket

Just one behavior – as simple as that.

public class Growl extends AbstractBehavior {

public Growl(final String title, final String text) {
this.title = title;
this.text = text;

public void renderHead(IHeaderResponse response) {
StringBuilder script = new StringBuilder();
script.append(“$(document).ready(function() {\n”);
script.append(“$.jGrowl(\”” + protectedString(text) + “\”, { header: ‘” + protectedString(title) + “‘, life: 10000 });”);
response.renderJavascript(script.toString(), “Growl”);


What’s missing is a jQuery-lib and jGrowl-lib Header Contribution if you do not load it by default in your app.

Using it in Wicket:

add(new Growl(“Info”, “My Info Text!”));

If you need it with AJAX, go to this blog.