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

📄 managerform.java

📁 本系统是网上购物的详细代码
💻 JAVA
字号:
package cn.com.tarena.ecport.web.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 org.apache.struts.upload.FormFile;

public class ManagerForm extends ActionForm {

	private static final long serialVersionUID = -6377988174344532467L;

	private String name;
	private String baseprice;
	private String description;
	private String author;
	private String publish;
	private String pages;
	private FormFile file;
	private Long categoryId;
	
	public FormFile getFile() {
		return file;
	}
	public void setFile(FormFile file) {
		this.file = file;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getBaseprice() {
		return baseprice;
	}
	public void setBaseprice(String baseprice) {
		this.baseprice = baseprice;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public String getAuthor() {
		return author;
	}
	public void setAuthor(String author) {
		this.author = author;
	}
	public String getPublish() {
		return publish;
	}
	public void setPublish(String publish) {
		this.publish = publish;
	}
	public String getPages() {
		return pages;
	}
	public void setPages(String pages) {
		this.pages = pages;
	}

	public Long getCategoryId() {
		return categoryId;
	}
	public void setCategoryId(Long categoryId) {
		this.categoryId = categoryId;
	}
	@Override
	public ActionErrors validate(ActionMapping mapping,
			HttpServletRequest request) {
		ActionErrors errors = new ActionErrors();
		String temp1 = "^[0-9]+[.]?[0-9]*$";
		String temp2 = "^[0-9]+$";
		
		if("".equals(name)){
			ActionMessage message = new ActionMessage("manager.error.productName");
			errors.add("productName",message);
		}
		if("".equals(author) || author == null){
			ActionMessage message = new ActionMessage("manager.error.author");
			errors.add("author",message);
		}
		if(publish == null || "".equals(publish)){
			ActionMessage message = new ActionMessage("manager.error.publish");
			errors.add("publish",message);
		}
		if(baseprice == null || "".equals(baseprice)){
			ActionMessage message = new ActionMessage("manager.error.price");
			errors.add("price",message);
		}else if(!baseprice.matches(temp1)){
			ActionMessage message = new ActionMessage("manager.error.priceGeShi");
			errors.add("priceGeShi",message);
		}
	    if(!("".equals(pages) || pages == null) && !pages.matches(temp2)){
			ActionMessage message = new ActionMessage("manager.error.yeMaGeShi");
			errors.add("yeMaGeShi",message);
		}
		return errors;
	}
	
	
}

⌨️ 快捷键说明

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