我知道几个方法,有的较笨..但很好用.呵呵
1.取变量值
var a = '<%=request.getAttribute("aaa");%>' ;
2.也可以将这个值放在页面上.再取出来.
<input type="hidden" value="<%=request.getAttribute("aaa");%>" id="aaa"/>
var a = document.getElementById('aaa').value ;
(注):对于对象,我推荐使用第二种方法.这样可以在页面中不IMPORT JAVA类..更符合现在编程
eg:
<input type="hidden" value="${student.name}" id="stuName"/>
var stuName = $('stuName').value ;// prototype.js新功能,简写.
温馨提示:答案为网友推荐,仅供参考