I want to access the jsp array in Javascript. How it is possible?
JSpCode
<%!
String s[];
%>
<%
List l=(List)request.getAttribute("listResource");
System.out.println("The Elements In List::"+l);
if(l!=null)
{
System.out.println("The Size of List::"+l.size());
int siz=l.size();
Iterator itr=l.iterator();
while(itr.hasNext())
{
s=new String[siz];
int i=0;
s[i]=itr.next().toString();
System.out.println("The Elments are:"+s[i]);
i++;
}
}
%>
JavaScriptCode
function verify_details()
{
var resourceId=document.getElementById("res").value;
var rid=new Array();
rid=<%=s%>
alert(rid[0]);
}
I tried like this but I am not getting the values.