[jsr-314-open] [JSF2.NEXT] Converers on Input/Output components.

Lincoln Baxter III lincolnbaxter at gmail.com
Thu Dec 10 01:26:29 EST 2009


Converters are a great tool, and I use them all the time -- problem is,
I sometimes need to use more than one converter (rich text processing,
for example) and that leaves me having to write my own converter chain
class, instantiating that class in a bean, then binding it to my Facelet
component through EL.

This seems like a lot of work, when what I'd really like to see is
chaining support out of the box. I see two potential issues to prevent
this:

    Object -> String

    String -> Object

Right now, chains only operate on strings. which could cause some
confusion, potentially, but I see reasons to enable multiple converters
per component, and convert (in list style) in the order in which the
converters were added. 

We allow multiple validators, but not multiple converters. This caveat
recently bit me as Kito found out, I was converting URLs into <a>  tags
as part of a comment output component. In order to accomplish this, I
was disabling encoding on the component itself, so that the converted
output <a> tag would not be rendered as text. I had attached a converter
prior to the link converter that was supposed to take care of the
escaping. Problem is... the last converter added in the Facelets file
wins because only one is allowed, so my site was (until I fixed it)
vulnerable to XSS attacks - a BIG problem.

I propose adding converter chaining, by default, to UIComponent. In
effect, turning converters into filters. This isn't a hard change,
doesn't add much complexity, but does fix one of those things that
people end up having to do themselves (Seam provides a ConverterChain,
and I did some Googling to find that many other people are doing this
themselves.) This is low hanging fruit that we can pick.

Thoughts?

---
Lincoln Baxter, III
http://ocpsoft.com
http://scrumshark.com
"Keep it Simple" 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jsr-314-open-mirror/attachments/20091210/9a410c9d/attachment.html 


More information about the jsr-314-open-mirror mailing list