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

📄 userlogonform.java

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

import javax.servlet.http.HttpServletRequest;

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

import com.elan.forum.util.ElCheckString;

public class UserLogonForm extends ActionForm {
	private String username;
	private String password;
	private String checkCode;

	/**
	 * @return the checkCode
	 */
	public String getCheckCode() {
		return checkCode;
	}

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

	/**
	 * @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;
	}
	
	/*
	 * (non-Javadoc)
	 * 
	 * @see org.apache.struts.action.ActionForm#validate(org.apache.struts.action.ActionMapping,
	 *      javax.servlet.http.HttpServletRequest)
	 */
	@Override
	public ActionErrors validate(ActionMapping mapping,
			HttpServletRequest request) {
		ActionErrors errors = new ActionErrors();
		if (ElCheckString.isEmptyString(username)) {
			
			if (ElCheckString.isEmptyString(password)) {
				errors.add("userlogonerr", new ActionError(
						"username.password.not.null"));
				System.out.println("用户和密码不能为空!");
			} else {
				errors.add("userlogonerr", new ActionError("username.not.null"));
				System.out.println("用户名不能为空!");
			}
		} else if (ElCheckString.isEmptyString(password)) {
			errors.add("userlogonerr", new ActionError("password.not.null"));
			System.out.println("密码不能为空!");
		}
		return errors;
	}

	@Override
	public void reset(ActionMapping mapping, HttpServletRequest request) {
		System.out.println("res");
		this.username = "";
		this.password = "";
		this.checkCode = "";
	}
	
}

⌨️ 快捷键说明

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