Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

If you are using Maven you can add the wicket-velocity dependency (otherwise you can download the jar from

Code Block

Create a javascript file with a vm extension

Code Block
<script language="JavaScript">
	function removeBlur(checked) {
		if(checked) {
			document.getElementById('${loginButtonId}').disabled = false; 
		} else {	
			document.getElementById('${loginButtonId}').disabled = true;

In your web page constructor add a javascript velocity header contributor

Code Block
final Button loginButton = new Button("input-login-button", ...){...};
final Map<String, String> vars = new HashMap<String, String>(1); vars.put("loginButtonId", loginButton.getMarkupId());
return new VelocityHeaderContributor().add(new
VelocityJavascriptContributor(MyWebPage.class, "path/to/example-script.vm", Model.valueOf(vars), "nameOfScript"));

The "loginButtonId" will be replaced by the generated wicket markup id in our a javascript file named "nameOfScript.js" for our MyWebPage.class