1027

  1. <body>  
  2.     <br>  
  3.    <%  
  4.    request.setCharacterEncoding("utf-8");  
  5.    String users=request.getParameter("username");  
  6.    String pass=request.getParameter("pwd");  
  7.    %>  
  8.    <%   
  9.     String driver = "com.mysql.jdbc.Driver";    
  10.     String url = "jdbc:mysql://127.0.0.1:3307/login";    
  11.     String use = "root";     
  12.     String password = "960404";    
  13.     Class.forName(driver);    
  14.     Connection conn= DriverManager.getConnection(url,use,password);    
  15.     PreparedStatement sql =conn.prepareStatement("insert into student(username,password)values(?,?)");  
  16.     sql.setString(1,users);  
  17.     sql.setString(2,pass);   
  18.     int rtn=sql.executeUpdate();  
  19.     sql.close();  
  20.     conn.close();  
  21.     %>  
  22.       
  23.   </body>  

posted on 2017-10-27 18:32  3r3r3www  阅读(640)  评论(0编辑  收藏  举报

导航