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

📄 registerform.java

📁 struts hibernate spring实现新闻发布系统含说明文档
💻 JAVA
字号:
/*
 * Generated by MyEclipse Struts
 * Template path: templates/java/JavaClass.vtl
 */
package com.ata.wx.java01b.struts.form;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

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.ActionMessage;

/** 
 * MyEclipse Struts
 * Creation date: 03-18-2008
 * 
 * XDoclet definition:
 * @struts.form name="registerForm"
 */
public class RegisterForm extends ActionForm {
	/*
	 * Generated fields
	 */

	/** email property */
	private String email;

	/** check property */
	private String check;

	/** name property */
	private String name;

	/** pwd property */
	private String pwd;

	/*
	 * Generated Methods
	 */

	/** 
	 * Method validate
	 * @param mapping
	 * @param request
	 * @return ActionErrors
	 */
	public ActionErrors validate(ActionMapping mapping,
			HttpServletRequest request) {
		ActionErrors errors=new ActionErrors();
		if(name.length()==0 || name==null){
			ActionMessage message=new ActionMessage("register.form.name0");
			errors.add("name",message);
		}
		if(name.length()>16){
			ActionMessage message=new ActionMessage("register.form.name1");
			errors.add("name",message);
		}
		if(name.length()>0 && name.length()<2){
			ActionMessage message=new ActionMessage("register.form.name2");
			errors.add("name",message);
		}
		if(!pwd.equals(check)){
			ActionMessage message=new ActionMessage("register.form.check");
			errors.add("check",message);
		}
		if(pwd.length()==0 || pwd==null){
			ActionMessage message=new ActionMessage("register.form.pwd1");
			errors.add("pwd",message);
		}
		if(pwd.length()>16 || pwd.length()<4 && pwd.length()>0){
			ActionMessage message=new ActionMessage("register.form.pwd");
			errors.add("pwd",message);
		}
		String pattern1 = "^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";
		Pattern pattern = Pattern.compile(pattern1);
		Matcher mat = pattern.matcher(email);
		if(!mat.matches()){
			ActionMessage message=new ActionMessage("register.form.email");
			errors.add("email",message);
		}
		return errors;
	}

	/** 
	 * Method reset
	 * @param mapping
	 * @param request
	 */
	public void reset(ActionMapping mapping, HttpServletRequest request) {
		// TODO Auto-generated method stub
	}

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

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

	/** 
	 * Returns the check.
	 * @return String
	 */
	public String getCheck() {
		return check;
	}

	/** 
	 * Set the check.
	 * @param check The check to set
	 */
	public void setCheck(String check) {
		this.check = check;
	}

	/** 
	 * Returns the name.
	 * @return String
	 */
	public String getName() {
		return name;
	}

	/** 
	 * Set the name.
	 * @param name The name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/** 
	 * Returns the pwd.
	 * @return String
	 */
	public String getPwd() {
		return pwd;
	}

	/** 
	 * Set the pwd.
	 * @param pwd The pwd to set
	 */
	public void setPwd(String pwd) {
		this.pwd = pwd;
	}
}

⌨️ 快捷键说明

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