在form里提交后,就可以用request取到值了啊,然后再往数据库里写!

解决方案 »

  1.   

    在form里提交后,就可以用request取到值了啊,然后再往数据库里写!
      

  2.   

    String year=request.getParameter("year");
    String month =request.getParameter("month");
    String day=request.getParameter("day");
      

  3.   

    你的列表框是分开的吧,我指的是年,月,日分别由三个框
    那就把你的年月日的值取得,然后拼成yyyy/mm/dd的形式存就可以了
      

  4.   

    String stryear=requset.getParameter("year");
    Connection con;
    Statement sql;
    ResultSet rs;
    try
    {
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    }
    catch(ClassNotFoundException event)
    {
    }
    try
    {
     con=DriverManager.getConnection("jdbc:odbc:数据源");
     sql=con.createStatement();
     String condition="insert into 表名 values"+"("+"'"+stryear+"')";
     sql.executeUpdate(condition);
     con.close();

    catch(SQLException e)
    {
    }
      

  5.   

    你的列表框是多选的吗?
      <select name="mulSelect" size="1" multiple>
        <option value="....">....
        <option value="....">....
        <option value="....">....
        <option value="....">....
        ....
      </select>提交后取值:
    String[] strArray = request.getParameterValues("mulSelect");
    if(strArray!=null && strArray.length>1){
      for(int i=0;i<strArray.length;i++){
        //生成SQL语句;
      }
    }
    //执行数据库数据插入语句。
      

  6.   

    <select><option value="2001">2001</option></select>
    标签出怎墨写???我照 lynx1111(任我行)sgdb(神天月晓) 的话试了下返回null
     
    另外;
       从数据库中调用数据,如何在列表框中显示????
    请高手赐教 !!!!
      

  7.   

    我的列表框非多选。往数据库中写我回的,现在是我不知道如何从列表框中取到值, 以及如何把值显示在列表矿中?烦请各位大侠帮我一把!!!!!!!!!!!!!!!!!!!!!!!!!!照lynx1111(任我行)sgdb(神天月晓)那样做,select><option 标签处该怎么写??
      

  8.   

    <form method="POST" action="--WEBBOT-SELF--">
         year:
      <select size="1" name="D1">
        <option value="1999">1999年</option>
        <option value="2000">2000年</option>
      </select>
    month:
       <select size="1" name="D2">
        <option value="1">1月</option>
        <option value="2">2月</option>
        <option value="3">3月</option>
      </select>date:<select size="1" name="D3">
        <option value="1">1日</option>
        <option value="2">2日</option>
        <option value="3">3日</option>
      </select><input type="submit" value="提交" name="B1"><input type="reset" value="全部重写" name="B2"></p>
    </form>

    String year=request.getParameter("D1");
    String month =request.getParameter("D2");
    String day=request.getParameter("D3");
    就可以得到年、月、日啊!
    ————————————————————————————————
    从数据库中调用数据,如何在列表框中显示????
    用html代码和jsp循环代码嵌套在一起显示:
    <form method="POST" action="--WEBBOT-SELF--">
     year:
      <select size="1" name="D1">、
    <%
       while rs.next()
       {
    %>
        <option value=<%=rs.getstring("year")><%=rs.getstring("year")</option>
    <%
        }
    %>
      </select>
    随手写的,仅做提示!
      

  9.   

    数据库字段有:year,month,day取值输出:
    while(rs.next()){
      out.print("日期:"+rs.getString"year");
      out.print("-"+rs.getString"month");
      out.println("-"+rs.getString"day");
    }
    //以上是伪代码,不可直接使用。
      

  10.   

    ocde(酬英雄志,动儿女情) 
    你的select控件不会没起名字吧??
    lynx1111(任我行) 的做法是对的
      

  11.   

    lynx1111(任我行) 的做法是对的。
    ocde(酬英雄志,动儿女情) 你说返回null的话,
    select控件的名字是不是没定义,或写错了。
    例<select name="ssssss">