📄 changepasswdform.java
字号:
package com.opensource.blog.web.form;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang.StringUtils;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import com.laoer.comm.util.Util;
public class ChangePasswdForm
extends ActionForm {
private String action;
private String newpasswd;
private String newpasswdre;
private String oldpasswd;
public ActionErrors validate(ActionMapping actionMapping, HttpServletRequest httpServletRequest) {
ActionErrors errors = new ActionErrors();
if (StringUtils.isBlank(this.action)) {
this.action = "show";
}
if (this.action.equalsIgnoreCase("change")) {
if (StringUtils.isBlank(this.newpasswd) || StringUtils.isBlank(this.newpasswdre) ||
StringUtils.isBlank(this.oldpasswd)) {
errors.add("error.nullerror", new ActionMessage("error.nullerror"));
}
if (newpasswd.length() < 3 || newpasswd.length() > 25) {
errors.add("error.reg.passwd0", new ActionMessage("error.reg.passwd0"));
}
if (!newpasswd.equals(newpasswdre)) {
errors.add("error.reg.passwd1", new ActionMessage("error.reg.passwd1"));
}
newpasswdre = Util.hash(this.newpasswd);
}
return errors;
}
public void reset(ActionMapping actionMapping, HttpServletRequest servletRequest) {
}
public String getAction() {
return action;
}
public String getNewpasswd() {
return newpasswd;
}
public String getNewpasswdre() {
return newpasswdre;
}
public String getOldpasswd() {
return oldpasswd;
}
public void setAction(String action) {
this.action = action;
}
public void setNewpasswd(String newpasswd) {
this.newpasswd = newpasswd;
}
public void setNewpasswdre(String newpasswdre) {
this.newpasswdre = newpasswdre;
}
public void setOldpasswd(String oldpasswd) {
this.oldpasswd = oldpasswd;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -