Hi, Here is a situation. There is a String array generated by a javabean (declared in a jsp page). I am thinking of passing the array data into a javascript function (which is embedded the jsp page) but not sure if it is possible. Please shed your light on it. I appreciate it very much. Yongping
Hi This is one way to implement the array in javascript.Here the jspclient is the array avaliable in jsp and htmlclient is the array to be created in javascript. <% out.println("<script>"); out.println("var htmlClient=new Array("+ jspClient.size()+");"); out.println("function filterClient()"); out.println("{"); out.println("var doc=document.forms[0];"); out.println("doc.client.options.length = 0;"); out.println("for(i=0,j=1;i<htmlClient.length;i++)"); out.println("{"); out.println("doc.client.options[j++] = new Option("+jspClient[i][1]+","+jspClient[i][0]+")"); out.println("}"); out.println("}"); out.println("</script>"); %> I hop this will be usefull to U Regards, Bhuvana
Post by:autobot
It's feeding time! Give me the food you were going to give to this tiny ad:
a bit of art, as a gift, that will fit in a stocking