Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to pass java arraylist into javascript arrays

807601May 5 2008 — edited Dec 6 2008
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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 3 2009
Added on May 5 2008
5 comments
2,448 views