注册界面 register.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
action方法
/**
* 查找用户是否存在
*
* @return
* @throws IOException
*/
public String findByName() throws IOException {
List listPerson = ms.findByName(name);
String findByNameTip;
if (listPerson.size() > 0) {
findByNameTip = "exist"; // 存在用户
} else {
findByNameTip = "noexist"; // 不存在用户
}
ServletActionContext.getResponse()。getWriter()。print(findByNameTip);
return null;
}