Jsp中如何实现复选框与下拉框联动!!

我需要做一个查询页面,通过复选框选定所要用到的下拉框,再通过下拉框选择要用的查询条件,这个应该怎么写,希望能给个具体的例子,下拉框的内容是从数据库里表中调出来的

第1个回答  2019-10-10
<option
checked>choose
vendor
name</option>
<%
//这里有个类连接数据库,查询需要的字段,并将其封装,返回个ArrayList
FreshBean
fb=new
FreshBean();
ArrayList
list=fb.getVendorMainInfo();
Iterator
it=list.iterator();
while(it.hasNext()){
VendorMainInfo
vmi=(VendorMainInfo)it.next();
%>
<option
value="<%=vmi.getVendor_name()%>">
<%=vmi.getVendor_name()%>
</option>
<%
}
%>
</select>
第2个回答  2015-10-15
采用 jQuery
第3个回答  推荐于2016-07-25
<option checked>choose vendor name</option>
<%
//这里有个类连接数据库,查询需要的字段,并将其封装,返回个ArrayList
FreshBean fb=new FreshBean();
ArrayList list=fb.getVendorMainInfo();
Iterator it=list.iterator();
while(it.hasNext()){
VendorMainInfo vmi=(VendorMainInfo)it.next();
%>
<option value="<%=vmi.getVendor_name()%>">
<%=vmi.getVendor_name()%>
</option>
<%
}
%>
</select>本回答被提问者采纳
相似回答