0
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",""), only now selectOneMenu kind of skips a line where it had the name I gave the . replace, how do I now remove this blank line ?
below is the method I am using to list in selectOneMenu it takes the name of the 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 this 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>
Is the data coming from the bank? To help you better, I suggest you post the codes you are using.
– Roknauta
Edit your question and post the code on it, it’s more readable please.
– Roknauta
edited see if it’s clearer now
– Renato Valadao
Also post your xhtml page.
– Roknauta
posted I hope it’s clearer
– Renato Valadao