Olá amigos, sou novo em JSF e me deparei com um erro meio bizarro. Tenho um método que me retorna uma lista de selectItem:
public List<SelectItem> getUsersOfSystem(){
List<SelectItem> toReturn = new LinkedList<SelectItem>();
for(User user : userDAO.getUsers()){
toReturn.add(new SelectItem(user, user.getNome()));
}
return toReturn;
}
e estou percorrendo essa lista dentro de um selectOnMenu:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
<title>Add new User</title>
</h:head>
<h:body>
<h1><h:outputText value="Adding new produtct to System" /></h1>
<h:form>
Id: <h:inputText value="#{productFace.selectedProduct.id}" /><br />
Name: <h:inputText value="#{productFace.selectedProduct.name}" /><br />
Price: <h:inputText value="#{productFace.selectedProduct.price}" /><br />
Stock: <h:inputText value="#{productFace.selectedProduct.stock}" /><br />
<!-- Aqui está o problema -->
Owner: <h:selectOneMenu value="#{productFace.selectedProduct.owner}">
<f:selectItems value="#{productFace.usersOfSystem}" />
</h:selectOneMenu>
<br />
<h:commandButton value="Cancel" action="gotoListProducts" />
<h:commandButton value="Add" action="#{productFace.finishAddNewProduct}" />
</h:form>
</h:body>
</html>
o console me retorna a seguinte mensagem de erro:
sourceId=j_idt9:j_idt19[severity=(ERROR 2), summary=(Erro de conversão ao definir o valor ‘Eduardo’ para ‘null Converter’. ), detail=(Erro de conversão ao definir o valor ‘Eduardo’ para ‘null Converter’. )]
Tentei fazer com uma lista de String e deu o mesmo problema… Alguém sabe o que pode ser??