I am getting the following error: Conversion Error setting value 'home' for 'null Converter'. Home is the string representation of what is being displayed.
To me, this doesnt make sense. Here is the JSF code:
<h:selectOneMenu value="#{createResourceDialogController.selectedDir}">
<f:selectItems value="#{createResourceDialogController.dirs}" />
</h:selectOneMenu>
And here is the ManagedBean code:
public Map<String,IDir> getDirs()
{
Map<String,IDir> retVal = new LinkedHashMap<String, IDir>();
List<IDir> dirs;
if(isCompanyResource)
{
dirs = convertToIDir(getCompanyDir());
}
else
{
dirs = convertToIDir(getUserDir());
}
for(IDir iDir : dirs)
{
retVal.put(iDir.getDir(),iDir);
}
return retVal;
}
public IDir getSelectedDir()
{
return selectedDir;
}
public void setSelectedDir(IDir selectedDir)
{
this.selectedDir = selectedDir;
}
To me, it appears that all the types match up and that converter isn’t even necessary. The getDirs() returns a map whose value is IDir. When the setter gets called, it should be getting the IDir? Any ideas?
JSF converts your
<h:selectOneMenu />in an htmlselect, which has only value and label attributes in plain text. So you need to use a converter for that, or also you can create aSelectItemlist with id-label values and when you receive the form just reloadIDirwith the id.xhtml
Backing Bean
Take a look to this tutorial. However you should consider going through a converter if you are going to reuse this code several times, as a cleaner solution.