Strange error received from compiler:
Expected a child component type of UISelectItem/UISelectItems for component type javax.faces.SelectOne(siachoice). Found javax.faces.component.UISelectItems.
So, if he was expecting UISelectItems and found UISelectItems, then where is the error?
My JSP implementation:
<h:selectOneMenu id="siachoice" value="#{dbSelectBean.currentOption}"> <f:selectItems value="#{dbSelectBean.dbs}" /> </h:selectOneMenu>
Method where I set the UISelectItem for UISelectItems:
private UISelectItems populateDatabases(String databaseString) { UISelectItems selects = new UISelectItems(); List<UISelectItem> result = new ArrayList<UISelectItem>(); StringTokenizer tokeniz = new StringTokenizer(databaseString, GlobalConstants.DELIMITER); while(tokeniz.hasMoreTokens()){ String tempDB = tokeniz.nextToken(); UISelectItem item = new UISelectItem(); item.setItemValue(tempDB); item.setItemLabel(tempDB); result.add(item); } selects.setValue(result); return selects; }
Then, of course, I set it to the bean dbs variable.
reference
source share