Linkage drop-down selection box, dynamically get the next level, displays the next level according to the previous level, this kind of benefit is that it does not read the drop-down box from the database, causing too much content, not very good choice. The first level link knows how to achieve it, and the multi-level linkage is also true. The examples listed here give you a reference and study.
Linkage drop-down box, just a Java file, a JSP file.
Table Structure A, Table ID VARCHAR2 (10), Name VARCHAR2 (10)
B Table ID VARCHAR2, NAME VARCHAR2 (10)
A Table content: 1 computer, 2 air conditioning 3 appliances
B Table Content: 1 Lenovo, 1 Foundation, 2 Haier, 2 Chunlan, 3 LG, 3 TCL
Mydbbean.java
. Import java.sql *; public class MyDbBean {Connection con = null; public First () {Class.forName ( "oracle.jdbc.driver.OracleDriver") newInstance (); con = DriverManager .getConnection ( "jdbc:. Oracle : @ 127.0.0.1: 1521: Test "," DD "," DD ");} Public ResultSet ExecuteQuery (String SQL) {PreparedStatement PSTM = NULL; ResultSet RS = NULL; TRY {PSTM = Con.PrepareStatement (SQL Rs = pstm.executeQuery (); return}} catch (sqlexception e) {E.PrintStackTrace (); return null;} catch (exception e) {E.PrintStackTrace (); return null;} finally {TRY NULL; {IF (rs! = Null) {} catch (exception e) {}}}}
Test.jsp
<% @ Page ContentType = "Text / HTML; Charset = GBK"%> <% @ page import = "Database. *"%> <% @ page import = "java.sql. *"%> <%! mydbbean bean = New mydbbean ();%>