jsp下拉菜单联动

来源:百度知道 编辑:UC知道 时间:2024/06/06 01:37:43
如何在刷新页面时得到数据库中的数据
<head>
<title>JSP for RegditForm form</title>
<script type="text/javascript">

function ShowDeptno(){
String sql = "select ID from tb1_dept;"
Connection conn =ConnectPool.getConnection();
conn.prepareStatement(sql);
ResultSet rs = conn.executeQuery(sql);
while(rs.next()){
out.print("< option value=' "rs.getString()"'>"rs.getString()"</option>");
}

}
</script>
</head>
<body>
<form action="./regist" method="get">

dephno:<select name="dephno" onchange="javascript:ShowDeptno()">
</select><br>
<input type="submit" value="submit">
<input type="

<script type="text/javascript">
这个写法是正确的吗?
它似乎只会在客户端运行吧?!
<%干嘛的?

那个东西怎么可以写在script 里面呢?用<%%>写,写在里面就可以了