Arraylist<String> to javascript array in jsp -


i having arraylist<string> reportnames sending request.setattribute("reportnames", reportnames);

how assign arraylist values javascript array on jsp.

 var myreports = [<%reportnames%>]; 

you bellow using jsp c:foreach , javascript push().


sample code:

var myreports  = []; <c:foreach var="reportname" items="${reportnames}">   myreports.push(${reportname}); </c:foreach> 

Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -