addthingformbean.java
来自「此资源是jsp应用开发 邓子云等编写的一书里的源代码」· Java 代码 · 共 51 行
JAVA
51 行
package formBean;
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;
/**
* @author dengziyun
* 封装输入审批事务信息表单数据的FormBean
*/
public class addThingFormBean extends ActionForm{
String thingTitle;//审批事务标题
String thingContent;//审批事务内容
/**
* 重置所有属性的值
*/
public void reset(ActionMapping arg0, HttpServletRequest request) {
thingTitle=null;
thingTitle=null;
}
/**
* 验证表单中的数据
*/
public ActionErrors validate(ActionMapping arg0, HttpServletRequest request) {
ActionErrors errors=new ActionErrors();
//------信息标题非空校验------
if(thingTitle==null||thingTitle.trim().length()<1)
errors.add("thingTitleIsNull",new ActionMessage("thingTitleIsNull"));
//------信息内容非空校验------
if(thingContent==null||thingContent.trim().length()<1)
errors.add("thingContentIsNull",new ActionMessage("thingContentIsNull"));
return errors;
}
public String getThingContent() {
return thingContent;
}
public void setThingContent(String thingContent) {
this.thingContent = thingContent;
}
public String getThingTitle() {
return thingTitle;
}
public void setThingTitle(String thingTitle) {
this.thingTitle = thingTitle;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?