public static void main(String args[])
{
try{
reg newreg = new reg();
System.out.println(newreg.reg("sssssssss","ssssss","ssssss","imagebear@163.com"));
DBConn myconn = new DBConn();
myconn.executeQuery("select * from tbl_user");
while(myconn.rs_next())
{
System.out.println(myconn.rs_getInt("id") + " " + myconn.rs_getString("name") + " " + myconn.rs_getString("pwd") + " " + myconn.rs_getString("email"));
}
System.out.println(newreg.getID());
}catch(Exception e){
System.err.println(e.toString());
}
}
};
说明:
1、该bean文件应和上文所述DBConn.class文件放于同一目录下
2、本例主要研究注册的过程,其中的Email检测等方法并不完善,若要应用请自行设计方法
四、编写用户登陆的Servlet:login.java
//login.java
//import required classes
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;