I would like to know if it is possible to remove a blank field in selectOneMenu, I have the following case, I have a selectOneMenu that displays several names, some names that I do not want to appear I used .replace ("name", " , but now the selectOneMenu kind of skips a line where I had the name I gave the .replace, how do I now remove this blank line?
Below is the method I'm using to list in selectOneMenu it picks up the name of files that are in a directory
public ArrayList<String> SearchFileStop (String p) throws SQLException{
DirControle dc = new DirControle();
File file = new File(String.valueOf(dc.selectedDir_CB()).replace("[", "").replace("]","")+"\"+p);
File afile[] = file.listFiles();
int i = 0;
for (int j = afile.length; i< j; i++){
File arq = afile[i];
listaFiles.add(arq.getName().replace("datasulDescargaBancos.bat","").replace(" ",""));
}
return listaFiles;
}
My bean
public ArrayList<String> selectedFile(String arq) throws SQLException{return sdir.SearchFile(arq);}
The SelectOneMenu, in which case the problem is in the second:
To:
<f:selectItem itemLabel="selecione" itemValue=""/>
<f:selectItems value="#{dir_controle.selectedDs()}" />
<p:ajax listener="#{scripts.listener}" update="arquivo" />
</h:selectOneMenu>
<label class="title4">Banco:</label>
<h:selectOneMenu id="arquivo" value="#{scripts.arquivo}" style="width: 200px">
<f:selectItem itemLabel="Selecione"/>
<f:selectItems value="#{dir_controle.selectedFile(scripts.pasta)}" />
</h:selectOneMenu>