When a JSF validator finds an error, the form is returned to the user so he or she can correct it.
当JSF验证器发现一个错误时,将向用户返回此表单,以便改正。
This ensures that error messages generated by the validator are correctly displayed in the form.
这确保验证器生成的错误消息正确地显示在表单中。
Server field validator—adds server-side validation to HTML form fields.
服务器字段验证器 —向HTML表单字段添加服务器端验证。
To use a custom validator you must add it to the form, passing it field elements on which the validation needs to be applied, as shown in Listing 14.
要使用定制验证器,必须将其添加到表单,并为它传递需要被验证的那些字段元素,如清单 14 所示。
The execute() method iterates over the list of validators, invoking the execute() method of each validator whose properties match the given form name and the optional element name.
execute()方法遍历验证器列表,调用每个验证器的 execute() 方法,这些验证器的属性与给定表单的名称和可选元素的名称相匹配。
In the Extension Element Details form on the right side of the plug-in editor, you can now select an existing validator class or create a new validator class (as in this case).
在插件编辑器右边的ExtensionElementDetails之中,现在您可以选择一个已存在的确认器类,或者创建一个新的确认器类(如该案例所示)。
Listing 1 shows the Validator function, which takes four parameters: a form name, an element name, an id, and a message.
清单1给出了Validator函数,该函数有4个参数:表单名称、元素名称、id和消息。
To illustrate the process of creating a custom validator, consider that in the CreateInput form, each seller is asked to enter a minimum and maximum expected price for his or her vehicle.
为了演示创建定制验证器的流程,请考虑CreateInput表单,其中每个销售者都要求输入其汽车的最低和最高价格。
The server-side WSIT extension in Listing 4 takes the form of a <wsss:ValidatorConfiguration> element and child <wsss:Validator> element, specifying the class to be used as a validator callback.
清单4 中的服务器端WSIT扩展以 <wsss:ValidatorConfiguration>元素和
The server-side WSIT extension in Listing 4 takes the form of a <wsss:ValidatorConfiguration> element and child <wsss:Validator> element, specifying the class to be used as a validator callback.
清单4 中的服务器端WSIT扩展以 <wsss:ValidatorConfiguration>元素和
应用推荐