📄 editaccountform.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 edit account screen.
* <ul>
* <li><b>oldpassword</b>-Entered oldpassword
* <li><b>password</b> - Entered password
* <li><b>confirmed password</b> - Entered confirmed password
* <li><b>email</b> - Entered the email
* </ul>
*
* @author Eric Lao
* @version 1.0 April 20,2002
*/
public final class EditAccountForm extends ActionForm {
/**
* user old password
*/
private String oldpassword = null;
/**
* password
*/
private String password = null;
/**
* Re-entered password
*/
private String confirmedPassword = null;
/**
* email
*/
private String email = null;
/**
* Return the user name( login id )
*/
public String getOldpassword() {
return (this.oldpassword);
}
/**
* Set the user name
*
* @param String - The user name
*/
public void setOldpassword( final String oldpassword ) {
this.oldpassword = oldpassword;
}
/**
* Return the password
*/
public String getPassword() {
return (this.password);
}
/**
* Set the password
*
* @param String - The password
*/
public void setPassword( final String password ) {
this.password = password;
}
/**
* Return the confirmedPassword
*/
public String getConfirmedPassword() {
return (this.confirmedPassword);
}
/**
* Set the confirmed password
*
* @param String - The confirmed password
*/
public void setConfirmedPassword( final String confirmedPassword ) {
this.confirmedPassword = confirmedPassword;
}
/**
* Return the email
*/
public String getEmail() {
return (this.email);
}
/**
* Set the email
*
* @param String - The email
*/
public void setEmail( final String email) {
this.email = email;
}
/**
* 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.oldpassword = null;
this.password = null;
this.confirmedPassword = 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 ((oldpassword == null) || (oldpassword.length() < 1)){
errors.add("oldpassword", new ActionError("error.oldpassword.required") );
}else if( oldpassword.length() < Account.PASSWORD_MIN_LENGTH ){
errors.add("oldpassword", new ActionError("error.password.minlength"));
}else if ( oldpassword.length() > Account.PASSWORD_MAX_LENGTH ){
errors.add("oldpassword", new ActionError("error.passwprd.maxlength") );
}else if ((password == null) || (password.length() < 1)){
errors.add("password", new ActionError("error.password.required"));
}else if( password.length() < Account.PASSWORD_MIN_LENGTH ){
errors.add("password", new ActionError("error.password.minlength"));
}else if ( password.length() > Account.PASSWORD_MAX_LENGTH ){
errors.add("password", new ActionError("error.password.maxlength"));
}else if( confirmedPassword.length() < Account.PASSWORD_MIN_LENGTH ){
errors.add("password", new ActionError("error.password.minlength"));
} else if ( ( confirmedPassword == null) || ( confirmedPassword.length() < 1)){
errors.add("password", new ActionError("error.confirmedPassword.required"));
}else if ( confirmedPassword.length() > Account.PASSWORD_MAX_LENGTH ){
errors.add("password", new ActionError("error.password.maxlength"));
}else if ( !confirmedPassword.equals( password ) ){
errors.add("password", new ActionError("error.password.misMatch"));
}else if ( ( email == null) || ( email.length() < 1)){
errors.add("email", new ActionError("error.email.required") );
}else if ( email.length() > Account.EMAIL_MAX_LENGTH ){
errors.add("email", new ActionError("error.email.maxlength") );
}
return errors;
}
}//EOC
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -