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

📄 friendactionform.java

📁 天乙代码src_531.rar 天乙代码src_531.rar 天乙代码src_531.rar 天乙代码src_531.rar
💻 JAVA
字号:
package com.laoer.bbscs.bbs.actionform;

import org.apache.struts.action.*;
import javax.servlet.http.*;
import com.laoer.bbscs.sysinfo.Sys;

public class FriendActionForm
    extends ActionForm {

  private String action;
  private String comment;
  private String fname;
  private String pages;
  private String sid;
  private String fid;

  public String getAction() {
    return action;
  }

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

  public String getComment() {
    return comment;
  }

  public void setComment(String comment) {
    this.comment = comment;
  }

  public String getFname() {
    return fname;
  }

  public void setFname(String fname) {
    this.fname = fname;
  }

  public String getPages() {
    return pages;
  }

  public void setPages(String pages) {
    this.pages = pages;
  }

  public String getSid() {
    return sid;
  }

  public void setSid(String sid) {
    this.sid = sid;
  }

  public String getFid() {
    return fid;
  }

  public void setFid(String fid) {
    this.fid = fid;
  }

  public ActionErrors validate(ActionMapping actionMapping,
                               HttpServletRequest httpServletRequest) {
    ActionErrors errors = new ActionErrors();
    if (sid == null || sid.length() == 0 || action == null ||
        action.length() == 0) {
      errors.add("parametererror", new ActionError("error.parametererror"));
    }
    if (pages == null || pages.length() == 0) {
      pages = "1";
    }
    if (action.equals("addfriend")) {
      if (fname == null || fname.length() == 0) {
        errors.add("friendnamenull", new ActionError("error.friendnamenull"));
      }
      if (comment == null) {
        comment = "";
      }
      comment = comment.trim();
      try {
        if (comment.getBytes(Sys.SYSINFO.CHARSET).length > 255) {
          errors.add("friendcommentlong",
                     new ActionError("error.friendcommentlong"));
        }
      }
      catch (Exception e) {
      }
    }
    if (action.equals("del")) {
      if (fid == null || fid.length() == 0) {
        errors.add("parametererror", new ActionError("error.parametererror"));
      }
    }
    return (errors);
  }

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

⌨️ 快捷键说明

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