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

📄 postform.java

📁 一个不错的bbs论坛系统.对初学者很有帮助
💻 JAVA
字号:
package com.yhbbs.article.form;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
/**
 * <p>Title:发表帖子的Form</p>
 * <br><b>WebSite: www.yyhweb.com</b>
 * <br><b>CopyRight: yyhweb[由由华网]</b>
 * @author stephen
 * @version YHBBS-2.0
 */
public class PostForm extends ActionForm{
	
	private static final long serialVersionUID = 1L;
	private int classId = 0;
	private int forumId = 0;
	private int artId = 0;
	private String action = "";
	private String ptitle = "";
	private String emot = "";
	private String content = "";
	private String repurl = "";
	private String votesel = "";
	private String votect = "";
	private int read = 0;
	private int moneynum = 0;
	
	/**
	 * @return 操作标示
	 */
	public String getAction() {
		return action;
	}
	/**
	 * @param action 操作标示
	 */
	public void setAction(String action) {
		this.action = action;
	}
	/**
	 * @return 区论坛Id
	 */
	public int getClassId() {
		return classId;
	}
	/**
	 * @param classId 区论坛Id
	 */
	public void setClassId(int classId) {
		this.classId = classId;
	}
	/**
	 * @return 帖子内容
	 */
	public String getContent() {
		return content;
	}
	/**
	 * @param content 帖子内容
	 */
	public void setContent(String content) {
		this.content = content.trim();
	}
	/**
	 * @return 表情
	 */
	public String getEmot() {
		return emot;
	}
	/**
	 * @param emot 表情
	 */
	public void setEmot(String emot) {
		this.emot = emot;
	}
	/**
	 * @return 论坛Id
	 */
	public int getForumId() {
		return forumId;
	}
	/**
	 * @param forumId 论坛Id
	 */
	public void setForumId(int forumId) {
		this.forumId = forumId;
	}
	/**
	 * @return 帖子标题
	 */
	public String getPtitle() {
		return ptitle;
	}
	/**
	 * @param ptitle 帖子标题
	 */
	public void setPtitle(String ptitle) {
		this.ptitle = ptitle.trim();
	}
	/**
	 * @return 替换文章URL
	 */
	public String getRepurl() {
		return repurl;
	}
	/**
	 * @param repurl 替换文章URL
	 */
	public void setRepurl(String repurl) {
		this.repurl = repurl;
	}
	/**
	 * @return 帖子Id
	 */
	public int getArtId() {
		return artId;
	}
	/**
	 * @param artId 帖子Id
	 */
	public void setArtId(int artId) {
		this.artId = artId;
	}
	/**
	 * @return 投票选项
	 */
	public String getVotesel() {
		return votesel;
	}
	/**
	 * @param votesel 投票选项
	 */
	public void setVotesel(String votesel) {
		this.votesel = votesel;
	}
	/**
	 * @return 投票内容
	 */
	public String getVotect() {
		return votect;
	}
	/**
	 * @param votect 投票内容
	 */
	public void setVotect(String votect) {
		this.votect = votect.trim();
	}
	/**
	 * @return 阅读帖子金钱数
	 */
	public int getMoneynum() {
		return moneynum;
	}
	/**
	 * @param moneynum 阅读帖子金钱数
	 */
	public void setMoneynum(int moneynum) {
		this.moneynum = moneynum;
	}
	/**
	 * @return 浏览帖子权限限制
	 */
	public int getRead() {
		return read;
	}
	/**
	 * @param read 浏览帖子权限限制
	 */
	public void setRead(int read) {
		this.read = read;
	}
	
	public ActionErrors validate(ActionMapping actionMapping, HttpServletRequest request) {	
		ActionErrors errors = new ActionErrors();
         if(ptitle.length()>50 || ptitle.length()<1)
        	 errors.add("article.post.title.error",new ActionMessage("article.post.title.error"));
         if(content==null || content.length()<1)
        	 errors.add("article.post.content.empty",new ActionMessage("article.post.content.empty"));
        
         return errors;
    }
	public void reset(ActionMapping actionMapping, HttpServletRequest request){
		classId = 0;
		forumId = 0;
		artId = 0;
		action = "";
		ptitle = "";
		emot = "";
		content = "";
		repurl = "";
		votesel = "";
		votect = "";
		read = 0;
		moneynum = 0;
	}
	
}

⌨️ 快捷键说明

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