⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ssneditor.java

📁 webwork source
💻 JAVA
字号:
/* * WebWork, Web Application Framework * * Distributable under Apache license. * See terms of license at opensource.org */package webwork.examples.userreg;import webwork.action.ValidationEditorSupport;/** *	@see java.beans.PropertyEditorSupport *	@see ValidationEditorSupport *	@author Kjetil H.Paulsen (kjetil@java.no) *	@version $Revision: 1.3 $ */public class SsnEditor extends ValidationEditorSupport {   public void setAsText(String txt) {      // Validate sosial security number      if (txt.length() == 0) {         throw new IllegalArgumentException("Birth number must be specified");      } else if (txt.length() != 11) {         throw new IllegalArgumentException("Norwegian sosial security number must be 11 digits");      }      try {         Long ssn = Long.decode(txt);      } catch (NumberFormatException nfe) {         throw new IllegalArgumentException("No characters or special signs, only digits allowed");      }      if (!Validator.checkSsn(txt)) {         throw new IllegalArgumentException("This is not valid Norwegian social security number");      }      setValue(txt);   }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -