我们偏向后一种方法,因为 它让我们可以将自定义转换器(自带验证逻辑)与特定的对象类型相关联,并让 JSF 处理这种对象类型。
We prefer the latter option because it allows us to simply associate a custom converter (with built-in validation logic) with a specific object type and have JSF handle that object type.
另一种方法是创建转换器组件,该组件使用一种类型的行为并产生另一种类型的属性。
Another approach is to create a converter component, which is a component that consumes an action of one type and produces a property of another type.
如果转换器产生了一个交易类型的对象,随后处理类必须包含一个名为handle (trade trade)的方法。
If the converter produced an object of type trade, then the handler class must contain a method named handle (trade trade).
应用推荐