Hi, #renderHead(IHeaderResponse response) { super.renderHead(response);
PackageTextTemplate template = new PackageTextTemplate(ClassName.class, "filename.js"); Map<String, Object> variables = .... ... response.render(OnDomReadyHeaderItem.forScript(template.asString(variables))); } Martin Grigorov Freelancer, available for hire! Wicket Training and Consulting https://twitter.com/mtgrigorov On Mon, Mar 16, 2015 at 2:14 PM, David Kaufman <david.kauf...@gmx.de> wrote: > Hello, > > I'm currently migrating a code snippet from version 1.4 to version 6: > > > add( TextTemplateHeaderContributor.forJavaScript( ClassName.class, > "filename.js", new LoadableDetachableModel<Map<String, > Object>>() { > @Override > protected Map<String, Object> load() { > final Map<String, Object> result = new > HashMap<String, Object>(); > result.put( "id", "static string ...." ); > // more parameters here > return result; > } > } ) ); > > The migration documentation ( > > https://cwiki.apache.org/confluence/display/WICKET/Migration+to+Wicket+1.5#MigrationtoWicket1.5-RemovedTextTemplateHeaderContributor/StringHeaderContributor > ) suggests using a custom template, e.g. > private TextTemplate template = CssTemplate(new MyTextTemplate()); > > Unfortunately, I can't find a TextTemplate which mimics the behavior in my > 1.4 code snippet. I found a JavaScriptTemplate, but I was unable to find a > way to use it, as it needs a TextTemplate instance in its constructor. > > Thanks, > David >