📄 person.java
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package com.shx.note.vo;import java.util.List;/** * * @author Administrator */public class Person { private int p_id; private String p_name; private String p_password; private String confirm_password; private String sex; private String email; // 此属性用于保存全部错误信息 private List errors; //验证登陆时出现错误的方法 public boolean invalidate() { boolean flag = true; // 验证ID // 验证ID是否为空 if (Integer.toString(this.p_id) == null || "".equals(Integer.toString(this.p_id))) { flag = false; errors.add("ID不能为空!"); } else { // 验证ID的长度是否满足,6-12位 if (Integer.toString(this.p_id).length() < 6 || Integer.toString(this.p_id).length() > 10) { flag = false; errors.add("ID的长度应为6-10位!"); } } // 验证p_password // 验证p_password是否为空 if (this.p_password == null || "".equals(this.p_password)) { flag = false; errors.add("密码不能为空!"); } else { // 验证ID的长度是否满足,6-12位 if (this.p_password.length() < 6 || this.p_password.length() > 12) { flag = false; errors.add("密码的长度应为6-12位!"); } } return flag; } //验证用户注册时出现错误的方法 public boolean reg_invalidate() { boolean flag = true; //验证姓名是否为空 if (this.p_name == null || "".equals(this.p_name)) { flag = false; errors.add("姓名不能为空!"); } //验证密码是否为空 if (this.p_password == null || "".equals(this.p_password)) { flag = false; errors.add("密码不能为空!"); } //验证确认密码是否为空 if (this.confirm_password == null || "".equals(this.confirm_password)) { flag = false; errors.add("确认密码不能为空!"); } //验证密码与确认密码是否一致 if (!(this.p_password.equals(this.confirm_password))) { flag = false; errors.add("密码与确认密码不一致!"); } //验证email是否为空 if (this.email == null || "".equals(this.email)) { flag = false; errors.add("E_mail不能为空!"); } return flag; } /** * @return the p_id */ public int getP_id() { return p_id; } /** * @param p_id the p_id to set */ public void setP_id(int p_id) { this.p_id = p_id; } /** * @return the p_name */ public String getP_name() { return p_name; } /** * @param p_name the p_name to set */ public void setP_name(String p_name) { this.p_name = p_name; } /** * @return the p_password */ public String getP_password() { return p_password; } /** * @param p_password the p_password to set */ public void setP_password(String p_password) { this.p_password = p_password; } /** * @return the confirm_password */ public String getConfirm_password() { return confirm_password; } /** * @param confirm_password the confirm_password to set */ public void setConfirm_password(String confirm_password) { this.confirm_password = confirm_password; } /** * @return the sex */ public String getSex() { return sex; } /** * @param sex the sex to set */ public void setSex(String sex) { this.sex = sex; } /** * @return the email */ public String getEmail() { return email; } /** * @param email the email to set */ public void setEmail(String email) { this.email = email; } /** * @return the errors */ public List getErrors() { return errors; } /** * @param errors the errors to set */ public void setErrors(List errors) { this.errors = errors; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -