急,联动下拉框,,不知道哪里错了,帮忙修改下!
联动下拉框,一个JAVA文件,一个JSP文件.
表结构 A,表 id varchar2(10),name varchar2(10)
B 表 id varchar2 ,name varchar2(10)
A表内容: 1 电脑, 2 空调 3 家电
B表内容:1 联想,1 方正,2 海尔, 2 春兰 , 3 LG,3 TCL
package DataBase;
import java.sql.*;
public class MyDbBean {
Connection con=null;
public MyDbBean() {
try {
Class.forName( "com.microsoft.jdbc.sqlserver.SQLServerDriver ").newInstance();
con=DriverManager.getConnection( "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=zhucen ", "sa ", " ");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public ResultSet executeQuery (String sql) {
PreparedStatement pstm=null;
ResultSet rs=null;
try {
pstm=con.prepareStatement(sql);
rs=pstm.executeQuery();
return rs;
}
catch(
SQLException e){
e.printStackTrace();
return null;
}catch (Exception e) {
e.printStackTrace();
return null;
}
finally{
try{
if(rs!=null)rs.close();
}catch(Exception e){}
}
}
}
<%@ page contentType= "text/html; charset=GBK " %>
<%@ page import= "DataBase.* " %>
<%@ page import= "java.sql.* " %>
<%! MyDbBean bean = new MyDbBean();%>
<html>
<head>
<title>
test
</title>
</head>
<body bgcolor= "#ffffff ">
<form method= "post " >
<select name= "dl " onChange= "javascript:window.location=(this.options[this.selectedIndex].value1) ">
<%
String id = request.getParameter( "id ");
String cSql = "select * from a &