Q: UISelectBoolean isSelected() always returns false regardless of state of checkbox I have the following block of HTML:
<div data-enhance="false">
  <label for="qc_20012" data-iconpos="right">Text</label>
  <div class="wrapper">
    <input id="qc_20012" type="checkbox" name="qc_20012">
    <label for="qc_20012"></label>
  </div>
</div>

I simply want to extract the state of the checkbox (isSelected true/false) using Java as seen below:
//id is the id of the HTML input (in this case, qc_20012)
UIComponent uiComponent = findComponent(id);
if (uiComponent instanceof UISelectBoolean) {
    UISelectBoolean comp = (UISelectBoolean) uiComponent;
    //always prints out 'false'
    System.out.println(comp.isSelected());
}

Here's findComponent. To be honest I don't really understand what's going on in there, so it's likely that this is where the problem lays. I've tried digging deeper but everything appears correct in there to me:
private UIComponent findComponent(final String id) {
    FacesContext context = FacesContext.getCurrentInstance();
    UIViewRoot root = context.getViewRoot();
    final UIComponent[] found = new UIComponent[1];
    root.visitTree(new FullVisitContext(context), new VisitCallback() {
            @Override
            public VisitResult visit(VisitContext context, UIComponent component) {
                if (component.getId() != null && component.getId().equals(id)) {
                    found[0] = component;
                    return VisitResult.COMPLETE;
                }
                return VisitResult.ACCEPT;
            }
        });
    return found[0];
}

No matter what, the comp.isSelected() line prints out false. Doesn't matter if the checkbox is checked, unchecked, or not on the page.
Here's the actual JSF that starts the chain that ends up calling this code:
<a4j:commandButton id="#{cc.attrs.id}"
                       value="#{cc.attrs.label}"
                       onclick="#{cc.attrs.onclick}"
                       data="#{cc.attrs.data}"
                       onbegin="#{cc.attrs.onbegin}"
                       onbeforedomupdate="#{cc.attrs.onbeforedomupdate}"
                       oncomplete="#{cc.attrs.oncomplete}"
                       immediate="#{cc.attrs.immediate}"
                       render="#{cc.attrs.render}"
                       execute="#{cc.attrs.execute}"/>


A: Since the checkbox component you are using is not a JSF component it is not available in JSF component tree. So it cannot be found in findComponent() method. Replace the line 

<input id="qc_20012" type="checkbox" name="qc_20012"/>

with 

<h:selectBooleanCheckbox id="qc_20012" name="qc_20012"/>

and it will work.
