title: Primefaces :radioButton inside a ui:repeat
body: <p>This is my xhtml code :</p>
  
  <pre><code> &lt;?xml version='1.0' encoding='UTF-8' ?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:ui="http://java.sun.com/jsf/facelets"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:p="http://primefaces.org/ui"&gt;
  
    &lt;h:head&gt;
      &lt;title&gt;Custom Radio Test&lt;/title&gt;
    &lt;/h:head&gt;
  
    &lt;h:body&gt;
  
      &lt;h:form id="mF" &gt;
  
        &lt;p:selectOneRadio id="ITRadioGrp" value="#{testBean.radioSelectedValue}" layout="custom"&gt;
          &lt;f:selectItems value="#{testBean.selectItems}" /&gt;
        &lt;/p:selectOneRadio&gt;
  
        &lt;h:panelGrid columns="1"&gt;
  
          &lt;ui:repeat id="vBGOF" value="#{testBean.groupOfFlights}" var="aFlight" varStatus="gofIndex"&gt;
            &lt;p:radioButton for="ITRadioGrp" itemIndex="#{gofIndex.index}"/&gt; #{aFlight}
          &lt;/ui:repeat&gt;
  
        &lt;/h:panelGrid&gt;
  
      &lt;/h:form&gt;
  
    &lt;/h:body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>and this is the managed bean : </p>
  
  <pre><code>    package com.modern;
  
  import javax.faces.bean.ManagedBean;
  import javax.faces.bean.RequestScoped;
  import javax.faces.model.SelectItem;
  import java.util.*;
  
  @ManagedBean
  @RequestScoped
  public class TestBean {
  
    private String radioSelectedValue;
    private String[] groupOfFlights;
    private List selectItems;
  
    public TestBean() {
      groupOfFlights = new String[]{"FlightOne", "FlightTwo", "FlightThree"};
    }
  
    public String[] getGroupOfFlights() {
      return groupOfFlights;
    }
  
    public void setGroupOfFlights(String[] groupOfFlights) {
      this.groupOfFlights = groupOfFlights;
    }
  
    public String getRadioSelectedValue() {
      return radioSelectedValue;
    }
  
    public void setRadioSelectedValue(String radioSelectedValue) {
      this.radioSelectedValue = radioSelectedValue;
    }
  
    // modified
    public List getSelectItems() {
      try {
        if (selectItems == null || selectItems.isEmpty()) {
          selectItems = new ArrayList();
          for (int g = 0; g &lt; 3; g++) {
            SelectItem option = new SelectItem(g, "flight" + (g + 1)); // value, label
            selectItems.add(option);
          }
        }
      } catch (Exception e) {
        System.out.println(this.getClass().getName() + "] EXCEPTION " + e.toString());
      }
      return selectItems;
    }
  
    public void setSelectItems(List selectItems) {
      this.selectItems = selectItems;
    }
  }
  </code></pre>
  
  <p>I always get the same error :</p>
  
  <p><strong>Cannot find component 'mF:ITRadioGrp' in view.</strong></p>
  
  <pre><code>javax.faces.FacesException: Cannot find component 'mF:ITRadioGrp' in view.
      at org.primefaces.component.radiobutton.RadioButtonRenderer.findSelectOneRadio(RadioButtonRenderer.java:144)
      at org.primefaces.component.radiobutton.RadioButtonRenderer.encodeEnd(RadioButtonRenderer.java:35)
      at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1763)
      at com.sun.faces.facelets.component.RepeatRenderer.encodeChildren(RepeatRenderer.java:104)
      at com.sun.faces.facelets.component.UIRepeat.process(UIRepeat.java:513)
      at com.sun.faces.facelets.component.UIRepeat.encodeChildren(UIRepeat.java:974)
      at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:304)
      at com.sun.faces.renderkit.html_basic.GridRenderer.renderRow(GridRenderer.java:185)
      at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:129)
      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1756)
      at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1756)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1759)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1759)
      at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:401)
      at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
      at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
  </code></pre>
  
  <p>I've tried to change the "for" attribute in </p>
  
  <pre><code>&lt;p:radioButton for="mF:ITRadioGrp" itemIndex="#{gofIndex.index}"/&gt; #{aFlight}
  </code></pre>
  
  <p>to (i checked the HTML source deleting the layout=custom" in p:selectOneRadio) :</p>
  
  <ol>
  <li>mF:ITRadioGrp</li>
  <li>ITRadioGrp</li>
  <li>mF:ITRadioGrp:0</li>
  <li>mF:ITRadioGrp:1 ...</li>
  </ol>
  
  <p>but always same error!!
  where i'm wrong???
  Thanks!</p>