Assume I have following code in a jsp file in JavaWeb:
<%
String myList = new String[10];
for(int i=0;i<10;i++){
myList[i] = String.valueOf(i);
}
%>
Now I want to get the value of the elements of myList in a loop of javascript: Are the following ways are correct?
<script type="text/javascript">
var arr = new Array(10);
for(var i=0;i<10;i++){
arr[i] = "<%=myList[i]%>"
}
<script>
If not, how could I reach my purpose?