caigoudingdanform.java

来自「自己写的一个java购销系统」· Java 代码 · 共 64 行

JAVA
64
字号
package com.yuanjin.mtgx.form;

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;

import com.yuanjin.mtgx.entity.CaiGouDingDan;
import com.yuanjin.mtgx.entity.GongYingShang;

public class CaiGouDingDanForm extends ActionForm {
	private CaiGouDingDan cgdd=new CaiGouDingDan();
	private String gysh;

	public String getGysh() {
		return gysh;
	}

	public void setGysh(String gysh) {
		this.gysh = gysh;
	}

	public CaiGouDingDan getCgdd() {
		return cgdd;
	}

	public void setCgdd(CaiGouDingDan cgdd) {
		this.cgdd = cgdd;
	}

	@Override
	public void reset(ActionMapping arg0, HttpServletRequest request) {
		// TODO Auto-generated method stub

		GongYingShang gys=(GongYingShang) request.getAttribute("gysForAddCaiGouDingDan");
		if(gys!=null){
			gysh=gys.getGysh();
			CaiGouDingDan caiGDD=new CaiGouDingDan();
			caiGDD.setMtpm(gys.getMtpz());
			caiGDD.setPzdj(gys.getJg());
			setCgdd(caiGDD);
		}
	}

	@Override
	public ActionErrors validate(ActionMapping arg0, HttpServletRequest arg1) {
		// TODO Auto-generated method stub
		ActionErrors errors=new ActionErrors();
		if(cgdd.getCgdbh()== null||cgdd.getCgdbh().length()==0){
			ActionMessage message=new ActionMessage("errors.cgdbh");
			errors.add("cgdbh",message);
		}
		if(cgdd.getCgsl()<=0){
			ActionMessage message=new ActionMessage("errors.cgsl");
			errors.add("cgsl",message);
		}
		return errors;
	}
	

}

⌨️ 快捷键说明

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