js怎么取出request中的对象的属相值

来源:互联网 发布:兰州大学网络教育学校 编辑:程序博客网 时间:2024/04/27 22:42

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
新功能,简写.

0 0