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

📄 bullform.java

📁 天乙社区6.0是一套基于JAVA技术的网络虚拟社区
💻 JAVA
字号:
package com.laoer.bbscs.web.form;

import org.apache.struts.validator.*;
import org.apache.struts.action.*;
import javax.servlet.http.*;
import com.laoer.comm.util.*;
import com.laoer.bbscs.sys.*;

/**
 * <p>Title: TianYi BBS</p>
 * <p>Description: TianYi BBS System</p>
 * <p>Copyright: Copyright (c) 2004</p>
 * <p>Company: LAOER.COM/TIANYISOFT.NET</p>
 * @author laoer
 * @version 6.0
 */

public class BullForm
    extends ValidatorForm {

  private String action;
  private String content;
  private int day;
  private long id;
  private int month;
  private short noend;
  private String title;
  private int year;

  public String getAction() {
    return action;
  }

  public void setAction(String action) {
    this.action = action;
  }

  public String getContent() {
    return content;
  }

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

  public int getDay() {
    return day;
  }

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

  public long getId() {
    return id;
  }

  public void setId(long id) {
    this.id = id;
  }

  public int getMonth() {
    return month;
  }

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

  public short getNoend() {
    return noend;
  }

  public void setNoend(short noend) {
    this.noend = noend;
  }

  public String getTitle() {
    return title;
  }

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

  public int getYear() {
    return year;
  }

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

  public ActionErrors validate(ActionMapping actionMapping,
                               HttpServletRequest httpServletRequest) {
    ActionErrors errors = new ActionErrors();
    if (action == null) {
      action = "list";
    }
    if (page == 0) {
      page = 1;
    }
    if (action.equals("add") || action.equals("editdo")) {
      if (title == null || title.trim().length() == 0 || content == null ||
          content.length() == 0) {
        errors.add("error.nullerror", new ActionError("error.nullerror"));
      }
      title = title.trim();
      if (SysUtil.getStrLength(title, Constant.CHARSET) > 150) {
        errors.add("error.bull.titletoolong",
                   new ActionError("error.bull.titletoolong"));
      }
      if (SysUtil.getStrLength(content, Constant.CHARSET) > 3000) {
        errors.add("error.bull.contenttoolong",
                   new ActionError("error.bull.contenttoolong"));
      }
      if (noend != 1) {
        if (Util.Date2Long(year, month, day) <= Util.getLongTime()) {
          errors.add("error.bull.endtime", new ActionError("error.bull.endtime"));
        }
      }
    }

    return errors;
  }

  public void reset(ActionMapping actionMapping,
                    HttpServletRequest httpServletRequest) {
  }
}

⌨️ 快捷键说明

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