噢,请原谅我没有说清楚,我的意思是:已经在jsp页面上显示了一张表出来,所有的数据项都是用text形式的,都可以修改。
问题是:修改完之后怎么将数据项提交回数据库的表里面?
我想到的方法很笨,希望有简单实用一点的方法。

解决方案 »

  1.   

    提交时还是只能交个另一个jsp文件处理,然后在那里逐个得到text项的值,然后连接数据库,存入就行了啊!
      

  2.   

    恩只能用手写的多条插入    给你个例子做参考//---------------- Insert/Update 操作 -------------------------------// 连接数据的信息
        String MM_editDriver = null, MM_editConnection = null, MM_editUserName = null, MM_editPassword = null;
        MM_editDriver     = MM_carmanager_DRIVER;
        MM_editConnection = MM_carmanager_STRING;
        MM_editUserName   = MM_carmanager_USERNAME;
        MM_editPassword   = MM_carmanager_PASSWORD;//  out.print(" SQL语句 "); //-->做调试用,查看SQL语句书写是否正确
        Driver MM_driver = (Driver)Class.forName(MM_editDriver).newInstance();
        Connection MM_connection = DriverManager.getConnection(MM_editConnection,MM_editUserName,MM_editPassword);//  在这里输入SQL执行    
        PreparedStatement MM_editStatement = MM_connection.prepareStatement(" SQL语句 ");
        MM_editStatement.executeUpdate();//插入多表,重复写上面二条语句
        MM_connection.close();
    //  对数据库操作成功后要转向的页面
        response.sendRedirect("../../../public/msg.jsp?msg="+"Success...");//--------------------- 事务 ------------------------------------------
    // 连接数据的信息
    try
    {
        String MM_editDriver = null, MM_editConnection = null, MM_editUserName = null, MM_editPassword = null;
        MM_editDriver     = MM_dbmain_DRIVER;
        MM_editConnection = MM_dbmain_STRING;
        MM_editUserName   = MM_dbmain_USERNAME;
        MM_editPassword   = MM_dbmain_PASSWORD;
        Driver MM_driver = (Driver)Class.forName(MM_editDriver).newInstance();
        Connection MM_connection = DriverManager.getConnection(MM_editConnection,MM_editUserName,MM_editPassword);    //事务开始
        MM_connection.setAutoCommit(false);
        String mysql1=""; //要执行的SQL语句
        String mysql2=""; //要执行的SQL语句
        //执行第一条语句
        PreparedStatement Statementd1 = MM_connection.prepareStatement(mysql1);
        ResultSet ds = Statementd1.executeQuery();
        //执行第二条语句    
        PreparedStatement Statementd2 = MM_connection.prepareStatement(mysql2);
        Statementd2.executeUpdate();
        //提交
        MM_connection.commit();
        //置回自动提交模式
        MM_connection.setAutoCommit(true);
        //关闭数据集连接等
        ds.close();
        Statementd1.close();
        Statementd2.close();
        MM_connection.close();
    }
    catch(Exception x)
    {
    //错误处理
    out.print(x.toString());
    return;
    }//  对数据库操作成功后要转向的页面 
        String tmp="index.jsp?";
        String msg="../../public/msg.jsp?msg=填加成功!&toURL="+tmp;
        msg=new String(tmp.getBytes("gb2312"),"iso8859-1");
        response.sendRedirect(msg);
    //-----------------------------------------------------------------------------------------------//---------------- 中文显示 -------------------------------------
    String msg=new String("../../../public/msg.jsp?msg=您没有登陆".getBytes("gb2312"),"iso8859-1");
    //---------------------------------------------------------------
      

  3.   

    假如你真的是以text形式显示的
    只有记住 各自name 
    然后提交另一个jsp 处理存储问题
      

  4.   

    to: zhangfan790913(笑月)
       请问这个循环i的具体用法是.....?