Programmatically populate values in a af:selectOneChoice component in ADF

Sharing is Caring

In this tutorial, you will see that how to populate af:selectOneChoice list from the managed bean, sometimes we need to use a custom list that is not model driven, this scenario can be implemented there

Follow these steps –

  • First of all, create a Fusion web application and a page in it
  • Now create a variable of type java.util.List in managed bean, and generate its accessors

    List<SelectItem> customList;

    public void setCustomList(List<SelectItem> customList) {
        this.customList = customList;

    public List<SelectItem> getCustomList() {
        return customList;


  • this list contains the value of type javax.faces.model.SelectItem; that is supported by af:selectOneChoice
  • It’s time to add values to the list, so to add values in this list I have written this code in getter of variable

    public List<SelectItem> getCustomList() {
        if (customList == null) {
            customList = new ArrayList<SelectItem>();
            customList.add(new SelectItem("i1","Item 1"));
            customList.add(new SelectItem("i2","Item 2"));
            customList.add(new SelectItem("i3","Item 3"));
            customList.add(new SelectItem("i3","Item 4"));
            customList.add(new SelectItem("i5","Item 5"));
        return customList;


  • Managed bean part is done, now add this to the view layer

  • Drop choice list in the page from the component palette
  •  Now bind choice list to bean List



  • See the page source after whole setup-
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="" version="2.1" xmlns:f=""
    < contentType="text/html;charset=UTF-8"/>
        <af:document title="listPage.jspx" id="d1">
            <af:form id="f1">
                <af:panelGroupLayout id="pgl1" layout="vertical" halign="center">
                    <af:spacer width="10" height="10" id="s1"/>
                    <af:selectOneChoice label="Custom List" id="soc1" contentStyle="font-weight:bold;color:darkgreen;">
                        <f:selectItems value="#{ListPolulatebean.customList}" id="si1"/>


  • Run this page and see programmatic choice list-
Cheers 🙂 Happy Learning

Related Posts

0 thoughts on “Programmatically populate values in a af:selectOneChoice component in ADF”

  1. HI Awasthi
    as per this scenario i am getting "i1" in side the valuchengeevent.getNewValue()
    but if i need "Item 1" inside valuchengeevent.getNewValue(),
    how will i get. please help me.

Leave a Reply

Your email address will not be published. Required fields are marked *