[jboss-user] [JBoss Seam] - problem with s:selectItems and noSelectionLabel
do-not-reply at jboss.com
Tue May 8 12:14:24 EDT 2007
I have a simple array of strings backing an <s:selectItems> for an <h:selectOneMenu>. When I don't set noSelectionLabel, it works fine. It renders the options something like
| <option value="durango">durango</option>
However, when I set noSelectionLabel, the menu doesn't function, because the options are rendered like
After some debugging, I found that the problem is in the ConverterChain that is attached to the HtmlSelectOneMenu component. JSF calls the converter to convert the value "durango" to a string during rendering, but the converter returns null (there's only one converter attached to the chain, a NoSelectionConverter, which returns NO_SELECTION_VALUE, so the chain returns null).
It looks like the there is normally a default converter to fall back on. I think the ConverterChain constructor tries to create a default converter based on the type of the value, but this doesn't work for Strings (debugging showed that facesContext.getApplication().createConverter(String.class) returns null).
So, I think the solution would be to have the ConverterChain constructor create a default pass-through String converter when valueBinding.getType(facesContext) is equal to String.class.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4043977#4043977
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4043977
More information about the jboss-user