1
I have a problem with the Primefaces autocomplete component. The value parameter is not being passed to my bean.
private String filtroClientes;
public List<String> listarFiltroDeClientes()
{
List<String> lista = new ArrayList<String>();
List<Cliente> clientesFiltrados = Clientes.buscarPorPartesDoNome(filtroClientes);
for(int i = 0; i < clientesFiltrados.size(); i++)
{
lista.add(clientesFiltrados.get(i).getNomeCliente());
}
return lista;
}
public String getFiltroClientes() {
return filtroClientes;
}
public void setFiltroClientes(String filtroClientes) {
this.filtroClientes = filtroClientes;
}
<p:autoComplete id="acCliente" value="#{projetosBean.filtroClientes}"
completeMethod="#{projetosBean.listarFiltroDeClientes()}"/>
When you print "filterClose" it shows the null value, or whatever was typed in the autocomplete input is not passing to the bean. Other than that the component is working normally, I have tested pass any string to filter the customers and the component worked.
Who can help already thank you. Thanks!!
created a get method for filterClients ?
– Dilnei Cunha
Yes I created the methods, interesting that if I start the variable with some value, it takes that value no longer updates it, that is to say get works the set does not.
– Marcos Siqueroli
Did you ever see the example there in the prime showcase? i haven’t used JSF anymore but in all examples I’ve seen it get in the listFiltroDeClient() method a String query ex: listFiltroDeClient(String query) to concatenate with the name ex: list.add(query + clientsFiltered.get(i).getNomeClient()); Another detail is that they do not use constructor in EL ex: completeMethod="#{projectsBean.listFiltroDeClients}" see: Auto Complete
– Dilnei Cunha
What is the Scopo of your managerbean ? See if you have Viewscope.
– Marcelo