📄 passwordhintform.java
字号:
package org.redsoft.forum.web;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
/**
* Form bean for password hints
* <ul>
* <li><b>username</b> - Entered the user registered name
* </ul>
*
* @author Johon Liu
* @pair watcher Waltson Tao
* @version 1.0 May 04,2002
*/
public class PasswordHintForm extends ActionForm
{
// the name entered by user who want to get his/her password
private String userName = null;
// setter method
public void setUserName(String userName) {
this.userName = userName;
}
// getter method
public String getUserName() {
return 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.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 ( userName == null || userName.length() == 0 ){
errors.add("user name", new ActionError("error.userName.required") );
}
return errors;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -