newnoticeform.java

来自「使用hibernate+struts2+spring实现的地址本管理系统」· Java 代码 · 共 73 行

JAVA
73
字号
package nm.user.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;

/**
 * <strong>NewNoticeForm </strong> handles the form that the user will use to
 * insert a new notice into the database.
 */

public final class NewNoticeForm extends ActionForm {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private String title = null;

	private String content = null;

	/**
	 * @return Returns the content.
	 */
	public String getContent() {
		return content;
	}

	/**
	 * @param content
	 *            The content to set.
	 */
	public void setContent(String content) {
		this.content = content;
	}

	/**
	 * @return Returns the title.
	 */
	public String getTitle() {
		return title;
	}

	/**
	 * @param title
	 *            The title to set.
	 */
	public void setTitle(String title) {
		this.title = title;
	}

	public void reset(ActionMapping mapping, HttpServletRequest request) {
		title = null;
		content = null;
	}

	public ActionErrors validate(ActionMapping mapping,
			HttpServletRequest request) {

		ActionErrors errors = new ActionErrors();

		if (((title == null) || (title.length() < 1)))
			errors.add("titleRequired", new ActionMessage(
					"notice.insert.title.required"));

		return errors;

	}
}

⌨️ 快捷键说明

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