I am getting an arraylist of objects from Java class and I want to pass this arraylist to a javascript function and get each object's properties inside the javascript function.
Please help me how to extract the value of the attributes inside the object.
Following is the code which I am using
`<script type="text/javascript">
var stats=new Array();
var i=0;
<%JobStats jobstat=new JobStats();
ArrayList<JobStats> stats=jobstat.Consolidate();
for(int i=0;i<stats.size();i++)
{
%>
stats[i]="<%=stats.get(i)%>";
i=i+1;
<%}%>
loadstats(stats);
</script>`
/* Javascript function*/
var array=new Array();
function loadstats(stats)
{
array=stats[0];
for(var key in array)
{
document.write(array[key]);
}
}