同意楼上。
使用JS的onchange函数。
使用JS的onchange函数。
解决方案 »
- org.springframework.beans.PropertyBatchUpdateException;
- 各位帮忙看看是什么原因啊 分数不够说话 很急 请各位帮帮忙啊
- MySQL连续插入
- spring事务配置问题
- struts1.x 的标签用起来感觉没有jstl爽,现在这个struts标签用得多吗?有必要花时间学习不?
- 有个myeclipse问题,我忘记是哪个菜单选项了!
- 自定义控件的问题?
- web service 客户端返回list为空的问题
- struts出错:“HTTP Status 404 - Servlet action is not available”
- ●●●●200分:BMP和CMP在Bean类、home接口的程序结构和内容上有什么区别,比如:findBy、、、和 method等方面的区别????
- javascript如何取struts标签中的值?
- 使用xfire+spring作webservice,在浏览器中可以访问到wsdl,客户端程序却连不上,请各位指点
用AJAX 很容易的
document.forms[0].xxxxxx.options[i] = new Option(name[j]); //这个是显示的值
document.forms[0].xxxxxx.options[i].value = id[j];//这个是要提交的值xxxxxx是你页面的那个select
两个select,上面那个onchange时,从库中去取相应的值赋给下面的select
<td>
<html:select property="manuFacture" styleClass="text" style="width:200px"onchange="setFactoryName(this.options[this.options.selectedIndex].value)">
<html:option value=""/>
<html:options name="factoryNameVec"/>
</html:select>
</td>
</tr>
<tr>
<td width="20%" class="text_left_red2">
<bean:message key="device_module"/>
:
</td>
------调用的函数代码(JAVASCRIPT)
function setFactoryName(factoryName){
if(factoryName != "null" && factoryName != ""){
document.all.canOperation.value="-1";
var selectstr=document.all.getModuleOrTypeAction.innerHTML;
selectstr=selectstr.substring(0,selectstr.indexOf(">")+1);
selectstr=selectstr+"<option value='-1'><bean:message key="wait_read_status"/></option></select>";
document.all.getModuleOrTypeAction.innerHTML=selectstr;
document.all.getDeviceModule.src='deviceTypeManageAction.do?method=getDeviceType&factoryName='+factoryName+'&tag=module'+'&selectStr='+selectstr;
}else if(factoryName != "null" && factoryName == ""){
var selectstr=document.all.getModuleOrTypeAction.innerHTML;
selectstr=selectstr.substring(0,selectstr.indexOf(">")+1);
selectstr=selectstr+"<option value=''></option></select>";
document.all.getModuleOrTypeAction.innerHTML=selectstr;
}
}
Jsp页面:
<TR>
<TD class=tr1>
所在地区
<html:select
property="province"
onchange="callBackForm.action='queryCallBack.163?method=queryBidArea';callBackForm.submit();">
<html:option value="-1">全部省份</html:option>
<html:optionsCollection property="provinceList" value="id"
label="name" />
</html:select>
<html:select property="city">
<html:option value="-1">全部城市</html:option>
<logic:present name="callBackForm" property="cityList">
<html:optionsCollection property="cityList" value="id"
label="name" />
</logic:present>
</html:select>
</TD>
......Action中的代码片断: // 填充行业
cbf.setTradeList(csMan.getTradeList());
cbf.setOperList(csMan.getCsOperatorList());
long pId = cbf.getTradeId();
if (pId > 0) {// 子行业
cbf.setChildTradeList(csMan.getChildTradeList(pId));
}
request.setAttribute(mapping.getAttribute(), cbf);
return mapping.getInputForward();
没有ajax之前都是这么做的。