5 Replies Latest reply: Dec 6, 2008 7:59 AM by DarrylBurke RSS

    How to pass java arraylist into javascript arrays

    807601
      Hi, i have declare an arraylist
      ArrayList list1 = new ArrayList();
      Inside the arraylist, there are elements. Now, i wan to pass the elements in the java arraylist into javascript arrays but i encounter javascript errors.
      This is how i code.
      var arr1 = new Array();
      <%
      for ( int x =0; x<list1.size(); x++)
      {
      %>
           arr1[<%=x%>] = <%=(String)list1.get(x)%>; 
      <%
      }
      %>
      how do i solve this problem?

      Thanks for the guidance in advance