2011-07-04 51 views
-1

在JSP中我有一个列表。它包含String类型的元素。我想用JavaScript访问这个列表。我该怎么做?如何从Javascript中访问JSP列表?

JSPCode

<%! List l;%> 
    <% 
     l=(List)request.getAttribute("listResource"); 
    %> 

JavaScriptCode

function verify_Resources() 
    { 
     var resourceId=document.getElementById("res").value; 
     var rid=<%=l%> 
    } 

我想请检查是否选择的ID在列表与否。

+0

可能重复[如何访问jsp数组变量到javascipt?](http://stackoverflow.com/questions/6556047/how-to-access-the-jsp-array-variable-into-javascipt) – ThiefMaster

+3

这与你最后一个问题有什么不同? – ThiefMaster

回答