文档介绍:UI控件、转换器和验证器实现了StateHolder接口表示组件具有了状态,可以保存一些组件自身的属性。   下面我们来看一个简单的例子。   这是一个正则表达式验证器的例子:public class RegexValidator implements Validator{    /**     * The message identifier of the Message to be created if     * the validation fails.     */    public static final String REGEX_INVALID_MESSAGE_ID =        "";            private String formatPatterns = null;        /**     * 出错时的提示内容名称,例如邮编     */    private String errorPatternDisplayName = null;        /**     * 获得样式的配置文件     */    private static final ResourceBundle bundle = ( + ".RegexPattern");        /**     * 资源配置文件中对应的样式名称     */    private String formatPatternName = null;        public RegexValidator()    {        super();    }        public RegexValidator(String formatPatternName)    {        setFormatPatternName(formatPatternName);    }        public void validate(FacesContext context, ponent, Object toValidate)            throws ValidatorException    {                if(context == null || component == null)            throw new NullPointerException();                if(!(component instanceof UIOutput))            return;                if(formatPatterns == null || () == 0 || null == toValidate)            return;                String value = ();        Pattern p = pile();        Matcher m =