Custom JavaScript

The Wicket viewer ships with embedded JQuery, so this can be leveraged, for example to perform arbitrary transformations of the rendered page on page load.

Similar to the application.css file, the Wicket viewer automatically serves the scripts/application.js javascript file in every page load. This is relative to the static package, under src/main/resources. Currently only one such .js file can be registered.

If you wish to change the location of the file, use the causeway.viewer.wicket.application.js configuration property.

Just because something is possible, it doesn’t necessarily mean we encourage it. Please be aware that there is no formal API for any custom JavaScript that you might implement to target; future versions of Apache Causeway might break your code.

As an alternative, consider using the ComponentFactory API described in the extending chapter.