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
Post a Comment