同意楼上。
使用JS的onchange函数。

解决方案 »

  1.   

    你说的是级联菜单吧  
    用AJAX 很容易的
      

  2.   

    Struts的标签里不知道能否用AJax?
      

  3.   

    数据量大的话就用ajax异步传输,如果数据量少的话就直接在onload()里把数据加前台用JS的数组接到,然后再用oncheng()来写循环加判断new Option就可以了。
    document.forms[0].xxxxxx.options[i] = new Option(name[j]); //这个是显示的值
    document.forms[0].xxxxxx.options[i].value = id[j];//这个是要提交的值xxxxxx是你页面的那个select
      

  4.   

    当然可以! 在onchange里面调用fireEvent("onsubmit")
      

  5.   

    给你写个例子
    两个select,上面那个onchange时,从库中去取相应的值赋给下面的select
    <td>              &nbsp;
                  <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"/>
                  :
                  &nbsp;
                </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;
      }
    }
      

  6.   

    我不会ajax阿,怎么办啊。谁能告诉我什么是ajax
      

  7.   

    我用Struts标志及Action实现的例子:
    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>&nbsp;                              
                    <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();
      

  8.   

    后面的Action中的代码本该是对地区处理的,即点省,出再相应城市,我贴错了,贴的是行业和子行业的,但原理是一样的。参考下就可。provinceList和cityList可以预先设置成对应Form的属性,也可直接在转入前用request.setAttribute(...)方法。
      

  9.   

    不用ajax也可以,页面再刷新一下就好了,
    没有ajax之前都是这么做的。