**Hi everybody, I've look around in this and in other forums but i can't resolve that problem: i want to select some elements of a list e put the selected elements in another list. This should be a simple thing but i got an error and i don't know why and how to resolve it. this is my controller:
@ManagedBean
@ViewScoped
public class Controller{
private ArrayList<String> keyColumns;
private List<String> keyColumnsAvailables;
//getters and setters
}
and this is my xhtml page:
<div>
<f:view>
<h:selectManyListbox value="#{controller.keyColumns}">
<f:selectItems value="#{controller.keyColumnsAvailables}"/>
</h:selectManyListbox>
</f:view>
</div>
now, the list of availables columns is printed normally but when i select some items and press de button, the page says : Validation Error.
I've tried to use Arrays instead Lists (same problem),to select items from a list of static elements (using ) and it works, but the list is set in another table of the page, so it cannot be static.
keyColumnsAvailable is an ArrayList filled up from a facade method who takes some information from a MongoCollection. If I add some elements in a method of controller like :
public List<String> lista(){
this.keyColumns1 = new ArrayList<>();
this.keyColumns1.addAll(this.eFacade.getKeyColumnsFile(String name));
return keyColumns1;
}
and i use :
<div>
<f:view>
<h:selectManyListbox value="#{controller.keyColumns}">
<f:selectItems value="#{controller.lista()}"/>
</h:selectManyListbox>
</f:view>
</div>
it works. But i have to select the Name from an uploaded file, who gives the List of available columns, and in this case i got a validation error,even thought i've verified that the list isn't null or empty.
To reassume, i select a file e with the name of this file i retrieve some information from mongoDB (return type is a list) in the Facade.This List is filled up correctly from the Facade method, but when i go to select some informations from the list --> validation error.
Others answers doesn't help me, do you have ideas?
Thanks