我需要访问maxLength自inputField定义验证。尽管我将maxLength其视为 中的字段之一UIComponent,但我没有看到相同的吸气剂。
谁能告诉我如何maxLength在我的自定义验证器中获得价值?
我需要访问maxLength自inputField定义验证。尽管我将maxLength其视为 中的字段之一UIComponent,但我没有看到相同的吸气剂。
谁能告诉我如何maxLength在我的自定义验证器中获得价值?
从理论上讲,如果您将UIComponentto 转换为它应该可以工作HtmlInputText。然后你可以使用getMaxlength()来返回该maxLength属性的值。
您可以检索为UIComponentusing定义的属性列表getAttributes()。它将返回一个Map<String,Object>.
Map<String,Object> listAttributes = myUIComponent.getAttributes();
Integer maxLength = (Integer) listAttributes.get("maxLength");
UIComponent - 请参阅 getAttributes 方法。
java.util.Map - Map 类的 Javadoc。