Use IHeaderResponse.renderJavaScript(CharSequence,String) to Avoid Duplicates

Apace Wicket Quick Tip

If you are working with multiple AjaxEventBehavior‘s (like AjaxFormSubmitBehavior and AjaxFormValidatingBehavior) on similar components in a Page and you are using IHeaderResponse.renderJavaScript(CharSequence) it’s possible you are contributing duplicate JavaScript over and over again to the header section of your Page unecessarily.

As it turns out, by simply changing to use the IHeaderResponse.renderJavaScript(CharSequence,String) method (providing a String ID for your JavaScript code), the default implementation of IHeaderResponse in Wicket will ignore duplicates automatically for you, keeping your pages more trim.

Tags: , , , , , , ,

About Riyad Kalla

Software development, video games, writing, reading and anything shiny. I ultimately just want to provide a resource that helps people and if I can't do that, then at least make them laugh.

, , , , , , ,

No comments yet.

Leave a Reply

*