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

📄 postthreadform.java

📁 一个功能较为完善的论坛
💻 JAVA
字号:
package org.redsoft.forum.web;


import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;


/**
 * Form bean for the post thread screen.
 * <ul>
 * <li><b>author</b>-Entered author value
 * <li><b>subject</b> - Entered subject value
 * <li><b>content</b> - Entered cotent value
 * <li><b>parent id </b> - Entered parent id value
 * </ul>
 *
 * @author Charles Huang
 * @version 1.0 March 10,2002
 */

public final class PostThreadForm extends ActionForm {

    /**
     *  The notify flag
     */
    private String notify = null;

    /**
     *  The category
     */
    private String category = null;

    /**
     * The author
     */
    private String author = null;


    /**
     * The title
     */
    private String subject = null;

    /**
     * The content
     */
    private String content = null;

    /**
     * The parent id
     */
    private String parentID = null;

    /**
     * The replied thread id
     */
    private String repliedThreadID = null;


    /**
     * Return the subject(title).
     */
    public String getSubject() {
	    return (this.subject);

    }


    /**
     * Set the subject
     *
     * @param subject The new subject
     */
    public void setSubject( final String subject ) {

        this.subject = subject;

    }


    /**
     * Return the content.
     */
    public String getContent() {

	    return (this.content);

    }


    /**
     * Set the content
     *
     * @param content The new content
     */
    public void setContent( final String content) {

        this.content = content;

    }

    /**
     * Return the author.
     */
    public String getAuthor() {

	    return (this.author);

    }


    /**
     * Set the author
     *
     * @param author The new author
     */
    public void setAuthor( final String author) {

        this.author = author;

    }


    /**
     * Return the parent id
     */
    public String getParentID() {

        return (this.parentID);

    }


    /**
     * Set the parentID
     *
     * @param parentID The new parentID
     */
    public void setParentID( final String parentID) {

        this.parentID = parentID;

    }

    /**
     * Return the category
     */
    public String getCategory() {

	    return (this.category);

    }


    /**
     * Set the category
     *
     * @param category The category this new thread under
     */
    public void setCategory( final String category) {

        this.category = category;

    }

    /**
     * Return the replied thread id
     */
    public String getRepliedThreadID() {

        return (this.repliedThreadID);

    }


    /**
     * Set the replied thread ID
     *
     */
    public void setRepliedThreadID( final String repliedThreadID) {

        this.repliedThreadID = repliedThreadID;

    }

    /**
     * Return the notify flag
     */
    public String getNotify() {

        return (this.notify);

    }


    /**
     * Set the notify
     *
     */
    public void setNotify( final String notify ) {

        this.notify = notify;
    }



    // --------------------------------------------------------- Public Methods


    /**
     * Reset all properties to their default values.
     *
     * @param mapping The mapping used to select this instance
     * @param request The servlet request we are processing
     */
    public void reset(ActionMapping mapping, HttpServletRequest request) {

    }


    /**
     * Validate the properties that have been set from this HTTP request,
     * and return an <code>ActionErrors</code> object that encapsulates any
     * validation errors that have been found.  If no errors are found, return
     * <code>null</code> or an <code>ActionErrors</code> object with no
     * recorded error messages.
     *
     * @param mapping The mapping used to select this instance
     * @param request The servlet request we are processing
     */
    public ActionErrors validate(ActionMapping mapping,
                                 HttpServletRequest request) {

        ActionErrors errors = new ActionErrors();
        if ((subject == null) || (subject.length() < 1)){
            errors.add("subject", new ActionError("error.subject.required"));
		}
		// Make sure the tilte is less than 64 characters
		else if( subject.length() > 64 ){
			errors.add("subject", new ActionError("error.subject.exceedMax"));
		}else if ((content == null) || (content.trim().length() < 1)){
            errors.add("password", new ActionError("error.content.required"));
		}
        return errors;

    }


}//EOC

⌨️ 快捷键说明

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