This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Child pages
  • JavaScript Value Injection Using wicket-velocity
Skip to end of metadata
Go to start of metadata

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


Create a javascript file with a vm extension

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

  • No labels