-
1. Re: selectitems converter
mopper Dec 2, 2010 8:52 AM (in response to renegritsch)My first idea would be that a <h:selectOneListBox/> does not display the value attribute of your SelectItems, but the label attribute. You might want to try setting the labels on the SelectItems you create in your getSelectItemList() method.
-
2. Re: selectitems converter
renegritsch Dec 3, 2010 5:24 AM (in response to mopper)Sure, then it works fine, but i do not want to have the same code as in the converter or called it twice.
For my opinion it´s a bug, because what for do i need the converter then?
-
3. Re: selectitems converter
mopper Dec 3, 2010 5:53 AM (in response to renegritsch)The converter is not meant to format your value in a nice readable format here. It is needed to convert from your object to a String value and back. Your <h:selectOneListBox/> will end up as a html <select/> with a bunch of <option value="foo" label="bar"/> elements. So when you submit your values, it needs the converter to get the object that corresponds with the value of the selected <option/>. The SelectItem list is used to render the component, but when the user submits, it needs the converter to be able to convert the string value back into an object.
It would probably be better to format the label in the method where you create the the list of SelectItems, and just leave the value unformatted. Then you do not need the formatting code in your converter.