I have been through almost all the related questions on SO but couldn't find the answer because I don't have the issues that were the cause of errors for other still I've same error result.
I have implemented a primefaces selectBooleanButton element and included the bean code as per that only. The error means that the system is unable to read the property of the managedBean but I have proper getter/setter methods as it should be for boolean property. Below is the code for reference:
View
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<ui:composition template="/templates/common/public.xhtml">
<ui:define name="title">Search</ui:define>
<ui:define name="content">
<div class="ui-grid ui-grid-responsive">
<div class="ui-grid-row">
<div class="ui-grid-col-10" id="mainCol">
<h:form id="search">
<h:panelGrid columns="2" cellpadding="5">
<h:outputText value="Choose: " />
<p:selectBooleanButton id="preference" value="#{searchForm.preference}" onLabel="Yes" offLabel="No" style="width:60px" />
</h:form>
</div>
</div>
</div>
</ui:define>
</ui:composition>
</html>
Bean:
@Named
@SessionScoped
public class SearchForm {
private boolean preference;
public boolean isPreference() {
return preference;
}
public void setPreference(boolean preference) {
this.preference = preference;
}
}
Error:
[glassfish 4.1] [SEVERE] [] [javax.enterprise.resource.webcontainer.jsf.application] [tid: _ThreadID=26 _ThreadName=http-listener-1(2)] [timeMillis: 1488954548903] [levelValue: 1000] [[
Error Rendering View[/search/searchForm.xhtml]
javax.el.PropertyNotFoundException: /search/searchForm.xhtml @49,156 value="#{searchForm.preference}": The class 'com.pc.SearchForm' does not have a readable property 'preference'.
Please suggest.