transferactionfrom.java

来自「该项为帮助银行工作人员处理银行业务」· Java 代码 · 共 61 行

JAVA
61
字号
package com.bluedot.bank.framework.web.actionform;

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 TransferActionFrom extends ActionForm {

	private static final long serialVersionUID = 1L;
	private String accountId1;
	private String accountId2;
	private String action2;
	public String getAccountId1() {
		return accountId1;
	}
	public void setAccountId1(String accountId1) {
		this.accountId1 = accountId1;
	}
	public String getAccountId2() {
		return accountId2;
	}
	public void setAccountId2(String accountId2) {
		this.accountId2 = accountId2;
	}
	public String getAction2() {
		return action2;
	}
	public void setAction2(String action2) {
		this.action2 = action2;
	}
	@Override
	public ActionErrors validate(ActionMapping mapping,
			HttpServletRequest request) {
		ActionErrors errors = new ActionErrors();
		if(this.action2.length()>11||!this.action2.matches("[0-9]{1,10}")){
			errors.add("action2", new ActionMessage("error.countLine2.rep"));
			return errors;
		}
		if(this.accountId1==null||this.accountId1.trim().isEmpty()){
			errors.add("accountId", new ActionMessage("error.accountId.re"));
		}
		if(this.accountId2==null||this.accountId2.trim().isEmpty()){
			errors.add("accountId2", new ActionMessage("error.accountId.re"));
		}
		if(this.action2==null||this.action2.trim().isEmpty()||Integer.valueOf(this.action2)<=0){
			errors.add("action2", new ActionMessage("error.countLine2.rep"));
		}
		if(this.accountId1.equals(this.accountId2)){
			errors.add("accountId2", new ActionMessage("error.accountId"));
		}
		
		return errors;
	}
	
	
	
}

⌨️ 快捷键说明

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