JSF converter for SelectOneMenu

The main JSF feature (or, at least, the one I like the most) is the ease to link controller bean attributes to xhtml view. However there’s an inherent important limitation: in the HTTP standard keys and values always will be strings, because they are sent that way. Of course you could serialize an object to base64, but a barbaric thing like that should be avoided in almost any circumstance.

Then how can we link a HTTP control to an object? For that, JSF provides converters. Well, it will allow you to program them, of course. Neither PrimeFaces, my library of choice, includes these converters. Thus, I’ve programmed a simple one for SelectOneMenu, the dropdown menus in the like of a combobox. I’ll leave it here for my own reference, and for anyone that could use it.

Continue reading “JSF converter for SelectOneMenu”