usersloginform.java

来自「图书管理系统,books manage system,java,jsp」· Java 代码 · 共 44 行

JAVA
44
字号
package com.oxliu.formbean;

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;

public class UsersLoginForm extends ActionForm {
	private String user_Name;
	private String user_Pwd;
	
	public String getUser_Name() {
		return user_Name;
	}
	public void setUser_Name(String user_Name) {
		this.user_Name = user_Name;
	}
	public String getUser_Pwd() {
		return user_Pwd;
	}
	public void setUser_Pwd(String user_Pwd) {
		this.user_Pwd = user_Pwd;
	}
	
	/*
	 * 方法:validate(ActionMapping mapping,HttpServletRequest request)
	 * 功能:用户登录信息不为空验证,返回error
	 */
	public ActionErrors validate(ActionMapping mapping,HttpServletRequest request){
		ActionErrors err=new ActionErrors();
		if(this.getUser_Name()==null || this.getUser_Name().length()<=1){
			//err.add("nameerr", new ActionMessage("err.user.login.namenullerr"));
			err.add("nameerror", new ActionMessage("err.user.login.namenullerr"));
		}
		if(this.getUser_Pwd()==null || this.getUser_Pwd().length()<1){
			err.add("passworderror", new ActionMessage("err.user.login.pwdnullerror"));
		}
		return err;
		
	}
}

⌨️ 快捷键说明

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