Struts开发指南之工作流程 - 编程入门网
word; }
public String getType() { return (this.type); }
public void setType(String type) { this.type = type; }
public String getUsername() { return (this.username); }
public void setUsername(String username) { this.username = username; }
/**
* 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.action = "Create";
this.autoConnect = false;
this.host = null;
this.password = null;
this.type = null;
this.username = 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 ((host == null) || (host.length() < 1))
errors.add("host",
new ActionError("error.host.required"));
if ((username == null) || (username.length() < 1))
errors.add("username",
new ActionError("error.username.required"));
if ((password == null) || (password.length() < 1))
errors.add("password",
new ActionError("error.password.required"));
if ((type == null) || (type.length() < 1))
errors.add("type",
new ActionError("error.type.required"));
else if (!"imap".equals(type) && !"pop3".equals(type))
errors.add("type",new ActionError("error.type.invalid", type));
return (errors);
}
}
Struts开发指南之工作流程(4)时间:2010-12-15logonAction
|
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |