skorza
skorza

Reputation: 21

How do I use a Freemarker template to display a JavaScript array in html?

If I generate an array in JavaScript, is it possible to configure a Freemarker template in the JavaScript code, in order to generate html which dynamically displays the array's elements?

Upvotes: 0

Views: 391

Answers (2)

李振纲
李振纲

Reputation: 382

freemarker can display javascript.

function doSomeThing(){
<#if !user??>
 location.href="www.xxx.com/login.htm"
</#if>

 other js
}

if you want to create dynamically js depend by the some arg you can use macro to define yourself function. to show some different js code snippet by the input arg.

Upvotes: 0

ddekany
ddekany

Reputation: 31152

If we are talking about JavaScript running in the browser, then no, because FreeMarker runs on the server side before the page is sent to the browser.

Upvotes: 1

Related Questions