struts中select下拉框数据问题
各位大虾,小弟有两个下拉框的问题:
1。我的下拉框是输入条件,当我选定一个值,进行查询后,查询完成,下拉框就恢复成默认值了,请问有什么办法能保留住这个输入的值。
2。我通过如下方式写了一个下拉框:
我写了一个jsp,中间用到select下来列表。我是通过动态赋值的。写法如下:
<select id= "locationTypeSelect " name= "locationTypeSelect " dataType= "Require ">
<option value= " "> 请选择 </option>
<%=locationTypeOptions%>
</select> </td>
我的变量locationTypeOptions是如下处理的:
String locationTypeOptions= " ";
if (locationTypes!=null){
for(Iterator locationTypeIte=locationTypes.iterator();locationTypeIte.hasNext();)
{
LocationTypeVO locationTypeVOs=(LocationTypeVO)locationTypeIte.next();
locationTypeOptions+= " <option value= "+locationTypeVOs.locationType+ "> "+locationTypeVOs.description+ " </option> ";
}
}
我想当下拉框的value变动时,显示也跟着同步变动,我这种方式能有办法实现吗?如果有,请问该怎么写呢?
谢谢!!
[解决办法]
使用struts标签,可以自动保留。
[解决办法]
<SELECT NAME= "xiangmulaiyuan1 " id= "xiangmulaiyuan1 " value= <%=xiangmulaiyuan1%> >
<%RecordSet3.executeProc( "workflow_SelectItemSelectByid ", "131 "+flag+ "0 ");
while(RecordSet3.next()){
String ifselected= " ";
if (xiangmulaiyuan1.equals(RecordSet3.getString( "selectvalue "))){
ifselected= "selected ";
}else{
ifselected= " ";
}
out.println( " <option value= "+RecordSet3.getString( "selectvalue ")+ " "+ifselected+ "> "+RecordSet3.getString( "selectname ")+ " </option> ");
}%>
</SELECT>
[解决办法]
Ajax实现二级联动下拉框
http://www.blogjava.net/rickhunter/articles/46582.html
[解决办法]
条件控件 和查询按钮在一个FORM
查询结果在一个IFRAM