Home  >  Article  >  Web Front-end  >  struts2 jquery combination to verify whether registered users exist_jquery

struts2 jquery combination to verify whether registered users exist_jquery

WBOY
WBOYOriginal
2016-05-16 16:50:441061browse

Registration interface register.jsp

Copy code The code is as follows:

<%@ page language= "java" contentType="text/html; charset=UTF-8"%>


Registration interface






















< h3>
User registration


Username:






Password :


Repeat password:







< ;/html>

action method
Copy code The code is as follows:

/**
* Find if the user exists
*
* @return
* @throws IOException
*/
public String findByName() throws IOException {
List listPerson = ms.findByName(name);
String findByNameTip;
if (listPerson .size() > 0) {
findByNameTip = "exist"; // User exists
} else {
findByNameTip = "noexist"; // User does not exist
}
ServletActionContext .getResponse().getWriter().print(findByNameTip);
return null;
}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn