cancel
Showing results for 
Search instead for 
Did you mean: 

Binding javascript nodes to freemarker templates

marcus
Champ in-the-making
Champ in-the-making
I'm trying to bind an array of nodes (the result of a search) in javascript to a freemarker template via node.processTemplate(template, args) where I've made args["resultset"] = searchResults. However, when it comes through to freemarker it's been converted to a freemarker.SimpleScalar, and is displayed as a flat string. Is there a better way to do this?
1 REPLY 1

kevinr
Star Contributor
Star Contributor
This is an interesting idea - however it is not directly supported at present as you have hit an area which needs more work. There is automatic type conversion for JavaScript API and for the FreeMarker API - however there is no type conversion between the two APIs!

One way to solve this would be to extract an array of NodeRef objects from your JavaScript nodes and pass them to FreeMarker - you can then lookup the nodes in FreeMarker using the node.nodeByReference[…] api.

Hope this helps,

Kevin