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

📄 newsinsertform.java

📁 J2EE电子商务系统开发从入门到精通---基于Struts和Hibernate技术实现
💻 JAVA
字号:
/*
 * NewsInsertForm.java
 *
 * Created on 2006年6月4日, 下午1:55
 */

package form.newspress;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

/**
 *
 * @author Administrator
 * @version
 */

public class NewsInsertForm extends org.apache.struts.action.ActionForm {
    private String title;
    private String author;
    private String content;
    private String year, month, day;
    private String typeId;
    private String remarks;

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getYear() {
        return year;
    }

    public void setYear(String year) {
        this.year = year;
    }

    public String getMonth() {
        return month;
    }

    public void setMonth(String month) {
        this.month = month;
    }

    public String getDay() {
        return day;
    }

    public void setDay(String day) {
        this.day = day;
    }

    public String getTypeId() {
        return typeId;
    }

    public void setTypeId(String typeId) {
        this.typeId = typeId;
    }

    public String getRemarks() {
        return remarks;
    }

    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }
    
    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        ActionErrors errors = new ActionErrors();
        if (getTitle() == null || getTitle().equals("")) {
            errors.add("title", new ActionMessage("errors.news.title.required"));
        }
        if (getAuthor() == null || getAuthor().equals("")) {
            errors.add("author", new ActionMessage("errors.news.author.required"));
        }
        if (getContent() == null || getContent().equals("")) {
            errors.add("content", new ActionMessage("errors.news.content.required"));
        }
        if (getYear() == null || getMonth() == null || getDay() == null) {
            errors.add("presstime", new ActionMessage("errors.news.presstime.required"));
        }
        if (getRemarks() == null) {
            errors.add("remarks", new ActionMessage("errors.newsp.remarks.required"));
        }
        return errors;
    }
}

⌨️ 快捷键说明

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