How to assign or initialize a Java array to Javascript array, without using JSP? -


i working in play framework , need use java array inside javascript.

i tried following -

var jsarray = ${javaarray}; 

where javaarray array in java controller, being rendered html view.

but, not working. can please me on this?

don't forget you're not passing variables... you're writing javascript code

so, have make array rendering nicely javascript

var jsarray = [%{javaarray.eachwithindex{it,idx->                  }%                  ${it}${(idx<javaarray.size()-1)?",":""}                  %{                  }                  }%] 

use fits template engine. have iterate through array prints out values on view

ps : i've used groovy notation...


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -