myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ali Ok <al...@aliok.com.tr>
Subject [GSOC] Implicit validation/conversion
Date Mon, 07 Jun 2010 21:28:08 GMT
Hi,

For <hx:color> component, I want to make sure sent value is a valid simple
color[0]. e.g: #F0A1B2
This is a good use case for a converter, but necessity for automatic
attaching makes things complicated.

I tried the approaches below, all of them have some problems, and I don't
want to follow them.

* Overriding setValue(..) method in HtmlInputColor which is the component
class :=) (breaks JSF lifecycle. Some manual validation is done, even though
validator processing phase is over)
* Attaching "ColorValidator implements Validator" at facelet handler
* At facelet handler, attaching "ColorConverter implements Converter" which
converts input to "Color" model pojo  (a component can have one converter,
so we should prevent other converters being attached, which is unacceptable)

Do we have a better alternative? Any example?

[0]
http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#valid-simple-color

Regards,
Ali

-- 
My Blog: http://blog.aliok.com.tr
Twitter: http://twitter.com/aliok_tr

Mime
View raw message