Struggling with what is probably simple code to append double quotes to each element either in the c:set or in the ArrayList or in the JavaScript variable.
After a c:set (which contains mother, baby etc) I populate an ArrayList (which then contains [mother, baby, child, staff] etc) and then 'get it' into JavaScript.
The final output is [mother, child, staff] etc but I need it to be ["mother", "baby", "child", "staff"] etc
After a sql:select -
<c:set var="type" value="${row.Type}" />
Add to an ArrayList -
types.add(pageContext.getAttribute("type"));
Get into javascript (after the jstl forEach loop completes)-
var typesArray = [<% for (int i = 0; i < types.size(); i++) { %>"<%=types.get(i)%>"<%= i + 1 < types.size() ? ",":"" %><% } %>];
Can't add double quotes to the c:set because it then escapes / fails -
<c:set var="type" value=""${row.Type}"" />
I don't really want to use StringBuffer because that affects the JavaScript get iterator which took me days to get working.
Assume old Java / old Javascript
Thoughts appreciated. Regards. Ralph
Use single / double quote wrapping ,
or
Similarly ,
or