Time for action – using the SelectBooleanButton component
Let us see how to save user preferences on subscribing to weekly e-mail notifications using the <p:selectBooleanButton>
component, by performing the following steps:
- Create a User Preferences form:
<h:form> <p:panel header="User Preferences" style="width: 400px; margin: 0 auto;"> <p:messages autoUpdate="true"/> <h:panelGrid columns="2" style="margin-bottom:10px" cellpadding="5"> <h:outputText value="Subscribe to Email Notifications: " /> <p:selectBooleanButton value="#{selectionController.subscribeToEmailNotif}" onLabel="Yes" offLabel="No" onIcon="ui-icon-check" offIcon="ui-icon-close"> <p:ajax update="display" listener="#{selectionController.handleEmailSubscription}"/> </p:selectBooleanButton...