/**
* 验证全部信息
*/
function checkAll() {
var nameInfo = $("nameInfo");
if (nameInfo.innerHTML == "该用户已存在!") {
alert("该用户已注册");
return false;
}
var flag = checkUserExists() && checkPwd() && checkRepwd() && checkEmail() ? true
: false;
return flag;
}
/**
*
*/
function register() {
getXmlHttpRequest();
var name = document.getElementById("name");
var pwd = document.getElementById("pwd");
var email = document.getElementById("email");
@SuppressWarnings("serial")
public class RegisterServlet extends HttpServlet {
/**
* Constructor of the object.
*/
public RegisterServlet() {
super();
}
/**
* Destruction of the servlet. <br>
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
}
/**
* The doGet method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to get.
*
* @param request
* the request send by the client to the server
* @param response
* the response send by the server to the client
* @throws ServletException
* if an error occurred
* @throws IOException
* if an error occurred
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request, response);
}
/**
* The doPost method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to
* post.
*
* @param request
* the request send by the client to the server
* @param response
* the response send by the server to the client
* @throws ServletException
* if an error occurred
* @throws IOException
* if an error occurred
*/
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// 获取用户名
String name = request.getParameter("userName");
user.setUserName(name);
int result = new UserDaoImpl().getUserCount(user);
System.out.println("this is line 93:>>>>");
if (result == 0) {
out.print("用户名合法!");
} else {
out.print("该用户已存在!");
}
} else if ("register".equals(type)) {
String name = request.getParameter("name");
String pwd = request.getParameter("pwd");
String email = request.getParameter("email");
/**
* Initialization of the servlet. <br>
*
* @throws ServletException
* if an error occurs
*/
public void init() throws ServletException {
// Put your code here
}