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

📄 sortform.java

📁 是一个网站的博客系统
💻 JAVA
字号:
package com.opensource.blog.web.form;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang.*;
import org.apache.struts.action.ActionMessage;

public class SortForm
    extends ActionForm {

  private String action;
  private String addsortname;
  private long sortid;
  private String upsortname;

  public String getAction() {
    return action;
  }

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

  public void setUpsortname(String upsortname) {
    this.upsortname = upsortname;
  }

  public void setSortid(long sortid) {
    this.sortid = sortid;
  }

  public void setAddsortname(String addsortname) {
    this.addsortname = addsortname;
  }

  public String getAddsortname() {
    return addsortname;
  }

  public long getSortid() {
    return sortid;
  }

  public String getUpsortname() {
    return upsortname;
  }

  public ActionErrors validate(ActionMapping actionMapping, HttpServletRequest httpServletRequest) {
    ActionErrors errors = new ActionErrors();
    if (StringUtils.isBlank(this.action)) {
      this.action = "show";
    }
    if (this.action.equalsIgnoreCase("add")) {
      if (StringUtils.isBlank(this.addsortname)) {
        errors.add("error.sort.sortnamenull", new ActionMessage("error.sort.sortnamenull"));
      }
    }
    if (this.action.equalsIgnoreCase("up")) {
      if (sortid == 0) {
        errors.add("error.parametererror", new ActionMessage("error.parametererror"));
      }
      if (StringUtils.isBlank(this.upsortname)) {
        errors.add("error.sort.sortnamenull", new ActionMessage("error.sort.sortnamenull"));
      }

    }

    if (this.action.equalsIgnoreCase("del")) {
      if (sortid == 0) {
        errors.add("error.parametererror", new ActionMessage("error.parametererror"));
      }
    }

    return null;
  }

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

⌨️ 快捷键说明

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