This discussion is archived
6 Replies Latest reply: May 9, 2012 3:54 AM by umesh.agarwal RSS

Rendering a selectOneChoice from a bean using Shays example

871235 Explorer
Currently Being Moderated
Hi,

I have extended Shays excellent [Creating Dynamic ADF Input Forms with Iterator|https://blogs.oracle.com/shay/entry/creating_dynamic_adf_input_forms] example to incorporate other components.

I am having a problem with the selectOneChoice component

I have included a List variable as part of the "Field" class and populate it within the constructor but no matter what I put in my page it will not populate the list elements of the selectOneChoice

I am able to access all the other values e.g. name, type, title, style etc using EL, just not the listOfItems2 (the list is rendered but with no elements in it)

Getters and setters exist, I have included the code below with two examples of how I have tried to get the page to render it, any help would be greatly appreciated

I'm using JDeveloper 11.1.2.0

(I did post a question on Shays blog last week but it seems to have got lost in the system)

Thanks
public class Field {

    public Field() {
        super();
    }
    
String name;
String type;
String title;
Boolean visible;
Boolean buttonVisible;
String value;
String style;
*List listOfItems2;*

public Field(String name,  String title, String type, String visible, String buttonVisible, String value, String style, List list2){ 

        super();
        this.name = name;
        this.type = type;
        this.title = title;
        this.visible = visible.contentEquals("Y");
        this.buttonVisible = buttonVisible.contentEquals("Y");
        this.value = value;
        this.style = style;

        *List listOfItems = new ArrayList();*

        *listOfItems.add(new SelectItem("Y", "Yes"));*
        *listOfItems.add(new SelectItem("N", "No"));*
        *listOfItems.add(new SelectItem("M", "Maybe"));*

        *this.listOfItems2 = listOfItems;*
    }
jsf1
   <af:selectOneChoice value="#{var.value}" id="soc2"
                       helpTopicId="#{var.name}"
                       binding="#{backingBeanScope.backing_claimCircs.soc2}">
           <af:selectItem id="si1" value="#{var.listOfItems2}"/>
   </af:selectOneChoice>
jsf2
   <af:selectOneChoice value="#{var.value}" id="soc2"
                       helpTopicId="#{var.name}"
                       binding="#{backingBeanScope.backing_claimCircs.soc2}">
       <af:forEach items="#{var.listOfItems2}"
                   var="lov">
           <af:selectItem id="si1" value="#{lov.value}"
                          label="#{lov.label}"/>
       </af:forEach>
   </af:selectOneChoice>
Edited by: Keyser on May 9, 2012 10:54 AM

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points