I need to pass this below array [aLocations] from jsp.
<script type="text/javascript">
var aLocations = new Array();
var aTitles = new Array();
var aDetails = new Array();
aLocations = ['keswick,cumbria,uk','grasmere,cumbria,uk','ambleside,cumbria,uk'];
</script>
if i tried like this, it is not working:
<%
ArrayList<String> myArr = new ArrayList<String>();
myArr.add("keswick,cumbria,uk");
myArr.add("grasmere,cumbria,uk");
myArr.add("ambleside,cumbria,uk");
%>
<script type="text/javascript">
var aLocations = new Array();
var aTitles = new Array();
var aDetails = new Array();
aLocations = <%=myArr%>;
</script>
what is the best approach to pass from JSP?