Hi, I have 2 dropdowns, the keys of the hashtable below are the options in dropdown1 and the the values are the superset. Dropdown2 shows the super set initially. By selecting a record(key) in dropdown1, Dropdown2 will show the subset base on the hashtable.
I think I need to add a onChange in 'select1' control, but no luck.
Thanks for any suggestions. - Megan
<body>
<%
Vector vec = new Vector();
vec1.addElement("aa");
vec1.addElement("bb");
vec1.addElement("cc");
Vector vec1 = new Vector();
vec1.addElement("aa11");
vec1.addElement("bb11");
vec1.addElement("cc11");
Vector vec2 = new Vector();
vec2.addElement("aa22");
vec2.addElement("bb22");
vec2.addElement("cc22");
Vector vec3 = new Vector();
vec3.addElement("aa33");
vec3.addElement("bb33");
vec3.addElement("cc33");
Hashtable hash = new Hashtable();
hash.put("aa",vec11);
hash.put("aa",vec22);
hash.put("aa",vec33);
Vector vecAll = new Vector();
vecAll.addElement("aa11");
vecAll.addElement("bb11");
vecAll.addElement("cc11");
vecAll.addElement("aa22");
vecAll.addElement("bb22");
vecAll.addElement("cc22");
vecAll.addElement("aa33");
vecAll.addElement("bb33");
vecAll.addElement("cc33");
%>
This is my JSP page. <br>
<% out.println("Hello my world");%>
<form action="HelloWorldServlet" method="post">
<SELECT NAME="select1" >
<%
for (int i = 0; i < vec.size(); i++) {
String content = (String)vec.elementAt(i);
%>
<option value="<%=content%>"><%=content%</option>
<%
}
%>
</SELECT>
<------------------->
<SELECT NAME="select2">
<%
for (int i = 0; i < vecAll.size(); i++) {
String content = (String)vecAll.elementAt(i);
%>
<option value="<%=content%>"><%=content></option>
<%
}
%>
</SELECT>
</form>
</body>
I think I need to add a onChange in 'select1' control, but no luck.
Thanks for any suggestions. - Megan
<body>
<%
Vector vec = new Vector();
vec1.addElement("aa");
vec1.addElement("bb");
vec1.addElement("cc");
Vector vec1 = new Vector();
vec1.addElement("aa11");
vec1.addElement("bb11");
vec1.addElement("cc11");
Vector vec2 = new Vector();
vec2.addElement("aa22");
vec2.addElement("bb22");
vec2.addElement("cc22");
Vector vec3 = new Vector();
vec3.addElement("aa33");
vec3.addElement("bb33");
vec3.addElement("cc33");
Hashtable hash = new Hashtable();
hash.put("aa",vec11);
hash.put("aa",vec22);
hash.put("aa",vec33);
Vector vecAll = new Vector();
vecAll.addElement("aa11");
vecAll.addElement("bb11");
vecAll.addElement("cc11");
vecAll.addElement("aa22");
vecAll.addElement("bb22");
vecAll.addElement("cc22");
vecAll.addElement("aa33");
vecAll.addElement("bb33");
vecAll.addElement("cc33");
%>
This is my JSP page. <br>
<% out.println("Hello my world");%>
<form action="HelloWorldServlet" method="post">
<SELECT NAME="select1" >
<%
for (int i = 0; i < vec.size(); i++) {
String content = (String)vec.elementAt(i);
%>
<option value="<%=content%>"><%=content%</option>
<%
}
%>
</SELECT>
<------------------->
<SELECT NAME="select2">
<%
for (int i = 0; i < vecAll.size(); i++) {
String content = (String)vecAll.elementAt(i);
%>
<option value="<%=content%>"><%=content></option>
<%
}
%>
</SELECT>
</form>
</body>