⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 userregform.java

📁 struts+hibernate BBS mysql数据库 功能基本齐全
💻 JAVA
字号:
package com.elan.forum.forms;

import java.sql.Timestamp;
import java.util.Date;

import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionError;

import com.elan.forum.util.ElCheckString;

public class UserRegForm extends ActionForm {

	private String username;
	private String password;
	private String trueName;
	private String sex;
	private String qq;
	private String icq;
	private String msn;
	private String email;
	private String address;
	private String phone;
	private String userFace;
	private Timestamp birthday;
	private String marriage;
	private Integer forumPoints;
	private String forumLevelPic;
	private String confirmPassword;
	private String question;
	private String answer;
	private Integer mobile;
	private String jobTitle;
	private String sign;
	private String Birthday_yy;
	private String Birthday_mm;
	private String Birthday_dd;
	

	public String getJobTitle() {
		return jobTitle;
	}

	public void setJobTitle(String jobTitle) {
		this.jobTitle = jobTitle;
	}

	/**
	 * @return the confirmPassword
	 */
	public String getConfirmPassword() {
		return confirmPassword;
	}

	/**
	 * @param confirmPassword
	 *            the confirmPassword to set
	 */
	public void setConfirmPassword(String confirmPassword) {
		this.confirmPassword = confirmPassword;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.apache.struts.action.ActionForm#reset(org.apache.struts.action.ActionMapping,
	 *      javax.servlet.http.HttpServletRequest)
	 */
	@Override
	public void reset(ActionMapping mapping, HttpServletRequest request) {
		// TODO Auto-generated method stub
		this.username = null;
		this.password = null;
		this.confirmPassword = null;
	}
	/*
	 * (non-Javadoc)
	 * 
	 * @see org.apache.struts.action.ActionForm#validate(org.apache.struts.action.ActionMapping,
	 *      javax.servlet.ServletRequest)
	 */
	@Override
	public ActionErrors validate(ActionMapping arg0, ServletRequest arg1) {
		// TODO Auto-generated method stub
		return super.validate(arg0, arg1);
	}

	/**
	 * @return the username
	 */
	public String getUsername() {
		return username;
	}

	/**
	 * @param username
	 *            the username to set
	 */
	public void setUsername(String username) {
		this.username = username;
	}

	/**
	 * @return the password
	 */
	public String getPassword() {
		return password;
	}

	/**
	 * @param password
	 *            the password to set
	 */
	public void setPassword(String password) {
		this.password = password;
	}

	/**
	 * @return the trueName
	 */
	public String getTrueName() {
		return trueName;
	}

	/**
	 * @param trueName
	 *            the trueName to set
	 */
	public void setTrueName(String trueName) {
		this.trueName = trueName;
	}

	/**
	 * @return the sex
	 */
	public String getSex() {
		return sex;
	}

	/**
	 * @param sex
	 *            the sex to set
	 */
	public void setSex(String sex) {
		this.sex = sex;
	}

	/**
	 * @return the qq
	 */
	public String getQq() {
		return qq;
	}

	/**
	 * @param qq
	 *            the qq to set
	 */
	public void setQq(String qq) {
		this.qq = qq;
	}

	/**
	 * @return the icq
	 */
	public String getIcq() {
		return icq;
	}

	/**
	 * @param icq
	 *            the icq to set
	 */
	public void setIcq(String icq) {
		this.icq = icq;
	}

	/**
	 * @return the msn
	 */
	public String getMsn() {
		return msn;
	}

	/**
	 * @param msn
	 *            the msn to set
	 */
	public void setMsn(String msn) {
		this.msn = msn;
	}

	/**
	 * @return the email
	 */
	public String getEmail() {
		return email;
	}

	/**
	 * @param email
	 *            the email to set
	 */
	public void setEmail(String email) {
		this.email = email;
	}

	/**
	 * @return the address
	 */
	public String getAddress() {
		return address;
	}

	/**
	 * @param address
	 *            the address to set
	 */
	public void setAddress(String address) {
		this.address = address;
	}

	/**
	 * @return the phone
	 */
	public String getPhone() {
		return phone;
	}

	/**
	 * @param phone
	 *            the phone to set
	 */
	public void setPhone(String phone) {
		this.phone = phone;
	}

	/**
	 * @return the userFace
	 */
	public String getUserFace() {
		return userFace;
	}

	/**
	 * @param userFace
	 *            the userFace to set
	 */
	public void setUserFace(String userFace) {
		this.userFace = userFace;
	}

	/**
	 * @return the birthday
	 */
	public Timestamp getBirthday() {
		return this.birthday;
	}

	/**
	 * @param birthday
	 *            the birthday to set
	 */
	@SuppressWarnings("deprecation")
	public void setBirthday(String yy, String mm, String dd) {
		this.birthday = new Timestamp(System.currentTimeMillis());
		this.birthday.setYear(Integer.parseInt(yy));
		this.birthday.setMonth(Integer.parseInt(mm));
		this.birthday.setDate(Integer.parseInt(dd));
	}
	
	/**
	 * @return the marriage
	 */
	public String getMarriage() {
		return marriage;
	}
	
	/**
	 * @param marriage
	 *            the marriage to set
	 */
	public void setMarriage(String marriage) {
		this.marriage = marriage;
	}

	/**
	 * @return the forumPoints
	 */
	public Integer getForumPoints() {
		return forumPoints;
	}

	/**
	 * @param forumPoints
	 *            the forumPoints to set
	 */
	public void setForumPoints(Integer forumPoints) {
		this.forumPoints = forumPoints;
	}

	/**
	 * @return the forumLevelPic
	 */
	public String getForumLevelPic() {
		return forumLevelPic;
	}

	/**
	 * @param forumLevelPic
	 *            the forumLevelPic to set
	 */
	public void setForumLevelPic(String forumLevelPic) {
		this.forumLevelPic = forumLevelPic;
	}

	public String getQuestion() {
		return question;
	}

	public void setQuestion(String question) {
		this.question = question;
	}

	public String getAnswer() {
		return answer;
	}

	public void setAnswer(String answer) {
		this.answer = answer;
	}

	public Integer getMobile() {
		return mobile;
	}

	public void setMobile(Integer mobile) {
		this.mobile = mobile;
	}

	public ActionErrors validate(ActionMapping mapping,
			HttpServletRequest request) {
		System.out.println("in the user reg validate form");
		ActionErrors errors = new ActionErrors();
		if (ElCheckString.isEmptyString(username)) {
			errors.add("userRegError", new ActionError("username.not.null"));
		}
		if (ElCheckString.isEmptyString(password)) {
			errors.add("userRegError", new ActionError("password.not.null"));
		}
		if (ElCheckString.isEmptyString(email)) {
			errors.add("userRegError", new ActionError("email.not.null"));
		}
		if (!ElCheckString.equals(password, confirmPassword)) {
			errors.add("userRegError", new ActionError("password.not.same"));
		}
		if(ElCheckString.isEmptyString(question)) {
			errors.add("userRegError", new ActionError("password.not.same"));
		}
		if(ElCheckString.isEmptyString(answer)) {
			errors.add("userRegError", new ActionError("password.not.same"));
		}
		if (0 == errors.size()) {
			System.out.println("输入无错误");
		} else {
			System.out.println(errors);
		}
		return errors;
	}

	public String getSign() {
		return sign;
	}

	public void setSign(String sign) {
		this.sign = sign;
	}

	public String getBirthday_yy() {
		return Birthday_yy;
	}

	public void setBirthday_yy(String birthday_yy) {
		Birthday_yy = birthday_yy;
	}

	public String getBirthday_mm() {
		return Birthday_mm;
	}

	public void setBirthday_mm(String birthday_mm) {
		Birthday_mm = birthday_mm;
	}

	public String getBirthday_dd() {
		return Birthday_dd;
	}

	public void setBirthday_dd(String birthday_dd) {
		Birthday_dd = birthday_dd;
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -