📄 editthreadform.java
字号:
package org.redsoft.forum.web;import org.apache.struts.action.ActionForm;import org.apache.struts.action.ActionError;import org.apache.struts.action.ActionErrors;import org.apache.struts.action.ActionMapping;import javax.servlet.http.HttpServletRequest;/** * Form bean for edit thread screen. * <ul> * <li><b>subject</b> - Entered subject value * <li><b>content</b> - Entered content value * <li><b>notify</b> - Entered notify value * </ul> * * @@author <a href="mailto:chjxm@msn.com">cinc</a> * * @@version $Id: EditThreadForm.java,v 1.1.1.1 2004/02/04 03:52:13 mustang Exp $ * */public final class EditThreadForm extends ActionForm { /** * the threadID */ private String threadID = null; /** * the subject */ private String subject = null; /** * The content */ private String content = null; /** * The notify flag */ private String notify = null; /** * return threadID */ public String getThreadID() { return this.threadID; } /** * set subject */ public void setThreadID(final String threadID) { this.threadID = threadID; } /** * return subject */ public String getSubject() { return this.subject; } /** * set subject */ public void setSubject(final String subject) { this.subject = subject; } /** * return content */ public String getContent() { return this.content; } /** * set content */ public void setContent(final String content) { this.content = content; } /** * return notify */ public String getNotify() { return this.notify; } /** * set notify */ public void setNotify(final String notify) { this.notify = notify; } /** * 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) { this.threadID = null; this.subject = null; this.content = null; this.notify = null; } /** * 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 ((threadID == null) || (threadID.length() < 1)){ errors.add ("threadID", new ActionError("error.threadID.invalid")); } if ((subject == null) || (subject.length() < 1)){ errors.add ("subject", new ActionError("error.subject.required")); }else if (subject.length() > 64){ errors.add ("subject", new ActionError("error.subject.exceedMax")); } if ((content == null) || (content.trim().length() < 1)){ errors.add ("content", new ActionError("error.content.required")); } return errors; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -