📄 password-validator.vm
字号:
#### Copyright(C) 2002 Javanovic Software (http://www.javanovic.com)#### This library is free software; you can redistribute it and/or## modify it under the terms of the GNU Lesser General Public## License as published by the Free Software Foundation; either## version 2.1 of the License, or (at your option) any later version.#### This library is distributed in the hope that it will be useful,## but WITHOUT ANY WARRANTY; without even the implied warranty of## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU## Lesser General Public License for more details.#### You should have received a copy of the GNU Lesser General Public## License along with this library; if not, write to the Free Software## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA##//---------------------------------------------------------// Application: $property.Name// Author : $property.Author// File : PasswordValidator.java//// Copyright $year $property.Company// Generated at $date.Time// using Karapan Sapi Struts Generator// Visit http://www.javanovic.com//---------------------------------------------------------package ${build.Package}.util;import org.apache.commons.validator.*;import org.apache.struts.validator.*;import org.apache.struts.action.ActionErrors;import javax.servlet.http.HttpServletRequest;import javax.servlet.ServletContext;public class PasswordValidator {public static boolean validatePassword(Object bean, ValidatorAction va, Field field, ActionErrors errors, HttpServletRequest request) { String value = ValidatorUtil.getValueAsString(bean, field.getProperty()); String sProperty2 = field.getVarValue("password2"); String value2 = ValidatorUtil.getValueAsString(bean, sProperty2); if (!GenericValidator.isBlankOrNull(value)) { try { if (!value.equals(value2)) { errors.add(field.getKey(), Resources.getActionError(request, va, field)); return false; } } catch (Exception e) { errors.add(field.getKey(), Resources.getActionError(request, va, field)); return false; } } return true; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -