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

📄 postform.java

📁 JSP论坛系统 数据库:mysql数据库; 技术平台:Tomcat 5.0服务器; 开发工具:Eclipse+Lomboz、EditPlus开发工具; 操作系统:Windows XP Prof
💻 JAVA
字号:
package mybbs;

import org.apache.struts.action.*;
import javax.servlet.http.*;
import org.apache.struts.upload.FormFile;

public class PostForm
    extends ActionForm {
  private String theText, username, userid, c_title, c_content, action,
      forumsid, topicid, postid, model, items;
  private org.apache.struts.upload.FormFile theFile; //文件框对应的是formFile类型

  public String getUsername() {
    return username;
  }

  public void setUsername(String username) {
    this.username = username;
  }

  public String getItems() {
    return items;
  }

  public void setItems(String items) {
    this.items = items;
  }

  public String getModel() {
    return model;
  }

  public void setModel(String model) {
    this.model = model;
  }

  public String getUserid() {
    return userid;
  }

  public void setUserid(String userid) {
    this.userid = userid;
  }

  public String getPostid() {
    return postid;
  }

  public void setPostid(String postid) {
    this.postid = postid;
  }

  public String getAction() {
    return action;
  }

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

  public String getC_title() {
    return c_title;
  }

  public void setC_title(String c_title) {
    this.c_title = c_title;
  }

  public String getC_content() {
    return c_content;
  }

  public void setC_content(String c_content) {
    this.c_content = c_content;
  }

  public void setTopicid(String topicid) {
    this.topicid = topicid;
  }

  public String getTopicid() {
    return topicid;
  }

  public String getTheText() {
    return theText;
  }

  public void setTheText(String theText) {
    this.theText = theText;
  }

  public String getForumsid() {
    return forumsid;
  }

  public void setForumsid(String forumsid) {
    this.forumsid = forumsid;
  }

  public org.apache.struts.upload.FormFile getTheFile() {
    return theFile;
  }

  public void setTheFile(org.apache.struts.upload.FormFile theFile) {
    this.theFile = theFile;
  }

  public ActionErrors validate(ActionMapping actionMapping,
                               HttpServletRequest httpServletRequest) {

    /**@todo: finish this method, this is just the skeleton.*/

    /*if(!this.getTheFile().getContentType().equals("image/pjpeg")){
      System.out.println("不是jpg");

         }*/
    //可以判断类型

    if (this.getTheFile().getFileSize() > 1000000) {

      System.out.println("长度大于1000");

    } //可以判断大小

    return null;

  }

  public void reset(ActionMapping actionMapping,
                    HttpServletRequest httpServletRequest) {

    username = null;
    userid = null;
    c_title = null;
    c_content = null;
    action = null;
    forumsid = null;
    topicid = null;
    theText = null;

  }

}

⌨️ 快捷键说明

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