可以说的具体一点吗
初学jsp,很多问题都不明白的说
多谢了

解决方案 »

  1.   

    本问题的背景:
    想制作一个两级联动的下拉框,一级(bigsortselect)列出一些省份的名字,二级(smallsortselect)列出一级当前省份的代码。
    现在的问题是:
    通过
       city=getParameter("bigsortselect");
    无法获得一级下拉框当前的值,从而无法组成SQL语句,进而得不到与之对应的该省的代码<%@ page contentType="text/html;charset=gb2312"
        import ="java.util.*,java.sql.*"%>
    <jsp:useBean id="area" scope="page" class="jspora.conora" /><html>
    <head>
    <title>后台产品添加</title>
    <meta http-equiv="Content-Type" content="text/HTML; charset=gb2312">
    <link href="../INC/Style.Css" rel="stylesheet" type="text/css">
     
    <script language = "JavaScript">
    var onecount;
    onecount=0;
    subcat = new Array();
     <%
     int count = 0;
     ResultSet rs,rs1,rs2;
     area.connect();
     String city,code;
     
     city =request.getParameter("bigsortselect");   /*******************问题在这里***********/ rs = area.Query("select districtcode from PROVINCEINFO where name = '" + city  +"'"); 
    while(rs.next())
    {
      String sname=new String(rs.getString("city_name"));//转换字符类型
      %>
      subcat[<%=count%>] = new Array("<%=sname%>");//产生数组
      <%
            count = count + 1;
    }
      %>
      onecount=<%=count%>;
     
      function changelocation()
        {
      
        document.form1.smallsortselect.length = 0;  
        var i;
        document.form1.smallsortselect.options[0] = new Option('选择二级分类','');
        for (i=0;i < onecount; i++)
            {           document.form1.smallsortselect.options   [document.form1.smallsortselect.length] = new Option(subcat[i][0]);
            
            }
        }      
        
    </script>
    </head>
    <body bgcolor="#FFFFFF">
     
    <form name="form1" method="post" action="">
    <table width="500"  border="0" cellspacing="0" cellpadding="0" align="center">
      <tr>
        <td width="180" height="20" align="right">选择一级分类:</td>
        <td width="320">

      <select name="bigsortselect"  onChange="changelocation(document.form1.bigsortselect.options[document.form1.bigsortselect.selectedIndex].value)" size="1">
        <option value="" >请选择一级分类</option>
    <%
     rs2 = area.Query("select province_name from provinceinfolist");
    while(rs2.next())
    {
     String Bname = new String(rs2.getString("province_name"));
     System.out.println(Bname);
    %>
       <option value="<%=Bname%>"><%=Bname%></option><%
    }
    %>
         </select><br>
        </td>
      </tr>
      <br>
      <tr>
        <td height="20" align="right">选择二级分类:</td>
        <td>
      <select name="smallsortselect">
        <option value="" selected>请选择二级分类</option>
     
         </select> 
     
     </td>
      </tr>
      
      
      <tr>
        <td height="20" colspan="2" align="center"><input type="submit" name="Submit" value="提交"></td>
      </tr>
    <script LANGUAGE="JavaScript">
        changelocation();
    </script>
    </table>
    </form>
     
    </body>
    </html>
      

  2.   

    再补充一下,getParameter("bigsortselect")获得的一直都是null