title: Radio button is reset after immediate action (converter and ui:repeat mysteriously involved)
body: <p>I came across a scenario were a set of radio buttons gets reset to a none-selected state whenever the view returns from an immediate action, although the actual value is processed correctly. Refreshing the view also displays the correct value. Weirdly enough, the behavior does only occur when the component uses an converter <em>and</em> is not inside a <code>ui:repeat</code> I narrowed it down to the following example:</p>
  <h3>JSF Page</h3>
  <pre><code>&lt;ui:repeat value=&quot;#{bean.stringList}&quot; var=&quot;item&quot; varStatus=&quot;iteration&quot;&gt;        
      #{item} 
      &lt;h:selectOneRadio value=&quot;#{bean.boolValue}&quot; rendered=&quot;#{iteration.last}&quot;&gt;
          &lt;f:selectItems value=&quot;#{bean.boolItemList}&quot; /&gt;
          &lt;f:converter converterId=&quot;testConverter&quot; /&gt;      
      &lt;/h:selectOneRadio&gt;&lt;br /&gt;&lt;br /&gt;
            
  &lt;/ui:repeat&gt;
  &lt;hr /&gt; 
  &lt;h:selectOneRadio value=&quot;#{bean.stringValue}&quot;&gt;
      &lt;f:selectItems value=&quot;#{bean.stringItemList}&quot; /&gt;                 
  &lt;/h:selectOneRadio&gt;    
  
  &lt;h:selectOneRadio value=&quot;#{bean.boolValue}&quot;&gt;
      &lt;f:selectItems value=&quot;#{bean.boolItemList}&quot; /&gt;
      &lt;f:converter converterId=&quot;testConverter&quot; /&gt;        
  &lt;/h:selectOneRadio&gt;
  
  &lt;p&gt;
  &lt;h:commandButton value=&quot;Submit&quot; type=&quot;submit&quot; /&gt;
  &lt;h:commandButton value=&quot;Do nothing, but immediate!&quot; immediate=&quot;true&quot; action=&quot;#{bean.doNothing}&quot; /&gt;
  &lt;/p&gt;
  
  &lt;p&gt;boolValue is: #{bean.boolValue}&lt;/p&gt;
  </code></pre>
  <h3>Backing Bean</h3>
  <pre><code>@ManagedBean(name = &quot;bean&quot;)
  @SessionScoped
  public class Bean {
  
  private List&lt;String&gt; stringList;
  private List&lt;SelectItem&gt; stringItemList;
  private List&lt;SelectItem&gt; boolItemList;
  private boolean boolValue;    
  private String stringValue;    
  private int removeParam;
  
  public Bean() {
      stringList = new ArrayList&lt;String&gt;();
      stringList.add(&quot;Test Item One&quot;);      
      stringList.add(&quot;Test Item Two&quot;);  
      
      stringItemList = new ArrayList&lt;SelectItem&gt;();
      stringItemList.add(new SelectItem(&quot;1&quot;, &quot;Option One&quot;));
      stringItemList.add(new SelectItem(&quot;2&quot;, &quot;Option Two&quot;));      
      
      boolItemList = new ArrayList&lt;SelectItem&gt;();
      boolItemList.add(new SelectItem(Boolean.TRUE, &quot;This is real&quot;));
      boolItemList.add(new SelectItem(Boolean.FALSE, &quot;This is not real&quot;));                                                                    
      }
  // + getters and setters
  
  public void doNothing(){
      }
  }
  </code></pre>
  <h3>Converter</h3>
  <pre><code>@FacesConverter(&quot;testConverter&quot;)
  public class TestConverter implements Converter {
  
  @Override
  public Object getAsObject(FacesContext context, UIComponent component, String value)
  {       
      if (value!= null) {
          if (value.equals(&quot;real&quot;))
          { 
          return Boolean.TRUE;          
          }
      }
      return Boolean.FALSE;
  }
  
  @Override
  public String getAsString(FacesContext context, UIComponent component, Object value) {
      boolean check = (Boolean) value;
      if (check)  return &quot;real&quot;;
      else        return &quot;unreal&quot;;
      }
  }
  </code></pre>
  <p>So we have:</p>
  <ul>
  <li>a group of radio buttons built from a backing bean list of <code>SelectItem(String, String)</code>, saved to a String. No converter needed.</li>
  <li>a group of radio buttons built from a backing bean list of <code>SelectItem(boolean, String)</code>, saved to a boolean. A converter is provided to map the boolean to some words (&quot;real&quot;/&quot;unreal&quot;) - just to replace the standard converter (&quot;true&quot;/&quot;false&quot;)</li>
  <li>A submit button + output to test if values get set correctly.</li>
  <li>A button with some immediate action, which does nothing else but change the JSF lifecycle.</li>
  </ul>
  <p>With this, one can play around and observe the following:</p>
  <ul>
  <li>Whenever the page returns from the immediate action, the radios with converter <em>outside</em> <code>ui:repeat</code> display no value, meaning: no radio is selected</li>
  <li>However, the value is actually set correctly during submit. Refreshing the page will results in correctly set radios.</li>
  <li>the <em>same</em> radio group <em>inside</em> <code>ui:repeat</code> works just fine, as does the one without the converter</li>
  </ul>
  <p>Testing around against better knowledge I checked that the converter-radios put inside a <code>&lt;c:foreach&gt;</code> instead of <code>ui:repeat</code> show the same error (which is as I would have expected, as it merely builds the tree and then vanishes) and that attaching some standard converter to the string-radios does not make them break. Regarding BalusC's comment, changing the bean to ViewScoped does not affect the problem  - only then, refresh gives you a blank default-initialized page.</p>
  <p>Here I am at the end of my knowledge. I don't really see how to reduce this any further or why it behaves like this. So... well... ideas anybody?</p>
  <p>Specs I got from the server guy: Mojarra JSF API Implementation 2.0.5-FCS, JSF 2.0 and Facelets, Server is a Weblogic 11g 10.3</p>