尊敬的个位,由于从C#的桌面程序转到JAVA的JSP的,不怎么会,谁有做好的JSP网页,比如对数据的增删改查功能,其他的暂时估计也用不到, 有的话给我发下,或者给出连接,谢谢了。再次表示感谢下。

解决方案 »

  1.   

    http://wenku.baidu.com/view/9bda64eb172ded630b1cb61b.html
    楼主可以参考下
      

  2.   

    关键是 写Java的代码,怎么在页面调用啊?
    最好是有个完整的例子,比如解决方案,我自己打开慢慢的看。比如说具体的代码 访问数据库的 我想和C#的差不多,我就是想找个完整的例子。
      

  3.   

    可以找本书看看,或者直接上网搜索jsp+servlet
      

  4.   

    慢慢研究,我现在不是学生了,上面给的时间是3天,已经过去两天了,我就看了加j2ee,其余的基本和 差不多,我知道是html那方面的。难道连个小例子都没有,我C#这样的小例子真的很多, 唉失望而归。
      

  5.   

    随便找个WEB项目,都会有这些的
      

  6.   


    // user 添加修改
    public static boolean updateUser(int userID, String username,
    String password, String sex, String email, String qq, String phone) {
    /*
     * update user information
     */
    Connection conn = null;
    boolean flag = false;
    try {
    conn = DB.getConnection();
    PreparedStatement ptmt = conn
    .prepareStatement("update user "
    + "set username=?, password=?, sex=?, email=?, qq=?, phone=?"
    + " where userID=?");
    ptmt.setString(1, username);
    ptmt.setString(2, password);
    ptmt.setString(3, sex);
    ptmt.setString(4, email);
    ptmt.setString(5, qq);
    ptmt.setString(6, phone);
    ptmt.setInt(7, userID);
    ptmt.executeUpdate();
    flag = true;
    } catch (Exception e) {
    flag = false;
    e.printStackTrace();
    } finally {
    DB.closeConnection(conn);
    }
    return flag;
    }
    //user删除
    public static boolean deleteUser(int userID) {
    boolean flag = false;
    Connection conn = null;
    try {
    conn = DB.getConnection();
    PreparedStatement ptmt = conn
    .prepareStatement("delete from user where userID = ?");
    ptmt.setInt(1, userID);
    ptmt.executeUpdate();
    ptmt.close();
    ptmt = conn.prepareStatement("delete from reply where userID = ?");
    ptmt.setInt(1, userID);
    ptmt.executeUpdate();
    ptmt.close();
    ptmt = conn.prepareStatement("delete from user where userID = ?");
    ptmt.setInt(1, userID);
    ptmt.executeUpdate();
    flag = true;
    } catch (Exception e) {
    flag = false;
    e.printStackTrace();
    } finally {
    DB.closeConnection(conn);
    }
    return flag;
    }
      

  7.   


    //DB 类
    package com.db;import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;public class DB { public static Connection getConnection() {
    Connection conn = null;
    try {
    String driver = "com.mysql.jdbc.Driver";
    String dbURL = "jdbc:mysql://localhost:3306/dbName?useUnicode=true&characterEncoding=UTF-8";
    String username = "root";
    String password = ""; Class.forName(driver).newInstance();
    conn = DriverManager.getConnection(dbURL, username, password);
    } catch (SQLException e) {
    // TODO: handle exception
    e.printStackTrace();
    } catch (Exception e) {
    // TODO: handle exception
    e.printStackTrace();
    }
    return conn;
    } public static void closeConnection(Connection conn) {
    try {
    conn.close();
    } catch (SQLException e) {
    // TODO: handle exception
    e.printStackTrace();
    } catch (Exception e) {
    // TODO: handle exception
    e.printStackTrace();
    }
    }}