项目需要,本人刚接触jsf,处于摸索阶段,前段时间写了个省市县三级联动,功能完全可以实现,但真心觉得比较繁琐,优化后将再次上传。1、页面代码如下:(1)Js部分: functionshowcity2(){ jQuery("#globalregionmb_getAllSecondCityList").click(); } functionshowcity3(){ jQuery("#globalregionmb_getThirdCityList").click(); } functionaftershowcity(){ varpro=jQuery("#one_province").val(); varcitiesname=jQuery("#one_city").val(); if(pro==-1){ jQuery("#one_city1").val(-1); jQuery("#one_city1").change(); }else{ jQuery("#one_city1").val(citiesname); jQuery("#one_city1").change(); jQuery("#one_countrytown1").val(""); } } functionaftershowcountrytown(){ varcountryname=jQuery("#one_countrytown").val(); jQuery("#one_countrytown1").val(countryname); }(2)xhtml页面部分:<tdwidth="80"class="firstred"> 省份</td><tdclass="fnormal"> <h:selectOneMenuid="one_province"value="#{}"maxlength="20"style="width:185px;"onchange="showcity2();" valueChangeListener="#{}"> <f:selectItemitemLabel="选择省份"itemValue="-1"/> <f:selectItemsvalue="#{}"/> </h:selectOneMenu></td></tr><tr><tdwidth="80"class="firstred"> 城市</td><tdclass="fnormal"><h:inputHiddenid="one_city"value="#{}"/><h:selectOneMenuid="one_city1"value="#{}"maxlength="20"style="width:185px;"onchange="showcity3();"valueChangeListener="#{}"> <f:selectItemitemLabel="选择城市"itemValue="-1"/> <f:selectItemsvalue
用jsf实现的省市县三级联动 来自淘豆网www.taodocs.com转载请标明出处.