Home > Default > Reading text file and display in the selectOnechoice list item In ADF.

Reading text file and display in the selectOnechoice list item In ADF.

October 11Hits:1
I have a requirement to read the text field which have list of strings and that string display in the SelectOneChoice List item component on page load.
I am using Jdeveloper version.
Any suggestion will highly appreciated..
Thanks in advance.


Google will produce you with hints on how to read content of a file from Java (ideally the file uses some delimiter). Then in a managed bean, you read the file and save its content in a list of SelectItem. So your managed bean should have the following property and setter/getter pairs
ArrayList<SelectItem> listFromFile = new ArrayList<SelectItem>();
public void setListFromFile(ArrayList l){ //you don't need this }
public ArrayList<SelectItem> getListFromFile(){
   //read file content and iterate over the file list entries
  for(i=0, i < fileContent.length, ++i){
     SelectItem si = new SelectItem();
     si.setValue(... the value to update the list of value with ...);
     si.setLabel("... the label to show in the list ...");
  return listFromFile;
}The af:selectOneChoice component should look as follows
<af:selectOneChoice id=".." value="...attribute to update with selection ..." ...>
   <f:selectItems value="#{managedBean.listFromFile}"/>

Read other 3 answers


Related Articles

Copyright (C) 2019 wisumpire.com, All Rights Reserved. webmaster#wisumpire.com 14 q. 0.499 s.