jsp在url中传递js变量var
我在编写jsp时因为要读取下拉框的值,所以插入了一个js
<SCRIPT type="text/javascript">
function check(){var id = document.getElementsByName("sel").value;
window.location.href='getdoctorlist.jsp?sname='+id;}
</script>
意思就是下拉框里选择一个值以后,重新打开网页对读取这个值,然后对数据库进行操作,但是貌似var变量不能被读取,因为打开新网页后url是这样的http://localhost:8080/hospital/admin/getdoctorlist.jsp?sname=undefined
java新手不知道该怎么解决这个问题