jsp - Passing value and iterating an arraylist in javascript -


i need pass arraylist javascript jsp , iterate through list in javascript. can me jsp synatax javascript iteration code?

tia

try code:

arraylist list = new arraylist(); list.add("aaa"); list.add("bbbb"); list.add("cccc"); iterator individualitems = list.iterator(); int = 0; string script = "<script type=\"text/javascript\">var list = new array();"; while(individualitems.hasnext()) {     script += "list["+i+"] = \""+individualitems.next()+"\";";     i++; } script += "for(i=0;i<list.length;i++){document.writeln(list[i]);}"; script += "</script>"; //now whatever want printwriter output = response.getwriter(); output.println(script); 

Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -