📄 pageform.java
字号:
package com.jdon.cms.events;
import org.apache.struts.action.*;
import javax.servlet.http.*;
import com.jdon.util.Debug;
public class PageForm
extends ActionForm {
public final static String module = PageForm.class.getName();
private String action;
private Integer id;
private String name;
private String htmlText;
private String title;
public void setId(Integer id) {
this.id = id;
}
public Integer getId() {
return id;
}
public void setAction(String action) {
this.action = action;
}
public String getAction() {
return action;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setHtmlText(String htmlText) {
this.htmlText = htmlText;
}
public String getHtmlText() {
return htmlText;
}
public void setTitle(String title) {
this.title = title;
}
public String getTitle() {
return title;
}
/**
*
* 1. Struts-config.xml<message-resources parameter="com.jdon.cms.ApplicationResources" />
* 2. in the Jsp there is <html:errors/>
* @param actionMapping
* @param httpServletRequest
* @return
*/
public ActionErrors validate(ActionMapping actionMapping,
HttpServletRequest httpServletRequest) {
Debug.logVerbose(" validate pageForm ", module);
ActionErrors errors = new ActionErrors();
if ( (action == null) || (action.length() < 1)){
Debug.logVerbose(" error: action is required ", module);
errors.add("action", new ActionError("error.action.required"));
}
if (action.equals("delete"))
return null;
if ( (name == null) || (name.length() < 1)){
Debug.logVerbose(" error: name is required ", module);
errors.add("name", new ActionError("error.name.required"));
}
if ( (title == null) || (title.length() < 1)){
errors.add("title", new ActionError("error.title.required"));
}
return errors;
}
public void reset(ActionMapping actionMapping,
HttpServletRequest httpServletRequest) {
Debug.logVerbose(" reset pageForm ", module);
this.id = null;
this.name = null;
this.title = null;
this.htmlText = null;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -