📄 updateinfoform.java
字号:
/**
*******************************************************************************
* UpdateInfoForm.java
*
* (c) Copyright 2008 Hewlett-Packard Development Company, L.P.
*
*<Program Content>
* System Name : Students Management System
*<Summarize>
* The file includes a class and the class main function is to collect the update
* information that the user inputs.
*<Update Record>
* 2009-4-28 1.00 zhangliy
*******************************************************************************
*/
package com.hp.eds.zhangliyuan.stuMan.form;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.validator.ValidatorForm;
/**
* The class main function is to collect the update information that the user
* inputs.
*
* @author zhangliy
* @version 1.0
*/
public class UpdateInfoForm extends ValidatorForm {
/**
* serialVersionUID
*/
private static final long serialVersionUID = 1L;
// the new password
private String newPassword;
// the confirm password
private String confirmPas;
// the new telephone
private String telephone;
// the new email
private String email;
/**
* confirmPas of get
*
* @return confirmPas
*/
public String getConfirmPas() {
return confirmPas;
}
/**
* confirmPas of set
*
* @param confirmPas
* set {bare_field_name}
*/
public void setConfirmPas(String confirmPas) {
this.confirmPas = confirmPas;
}
/**
* email of get
*
* @return email
*/
public String getEmail() {
return email;
}
/**
* email of set
*
* @param email
* set {bare_field_name}
*/
public void setEmail(String email) {
this.email = email;
}
/**
* newPassword of get
*
* @return newPassword
*/
public String getNewPassword() {
return newPassword;
}
/**
* newPassword of set
*
* @param newPassword
* set {bare_field_name}
*/
public void setNewPassword(String newPassword) {
this.newPassword = newPassword;
}
/**
* telephone of get
*
* @return telephone
*/
public String getTelephone() {
return telephone;
}
/**
* telephone of set
*
* @param telephone
* set {bare_field_name}
*/
public void setTelephone(String telephone) {
this.telephone = telephone;
}
/**
* judge whether the new password is equal to the confirm password
*
* @param mapping
* @param request
* @return ActionErrors
* @see org.apache.struts.validator.ValidatorForm#validate(org.apache.struts.action.ActionMapping,
* javax.servlet.http.HttpServletRequest)
*/
@Override
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
ActionErrors error=super.validate(mapping, request);
ActionErrors errors = new ActionErrors();
if (newPassword == null && confirmPas != null) {
errors.add("notequal", new ActionMessage("errors.notequal"));
return errors;
}
if (newPassword != null && confirmPas == null) {
errors.add("notequal", new ActionMessage("errors.notequal"));
return errors;
}
if (newPassword != null && confirmPas != null) {
if (!newPassword.equals(confirmPas)) {
errors.add("notequal", new ActionMessage("errors.notequal"));
return errors;
}
}
return error;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -