Reputation: 474
I added an <p:inputSwitch>
in my JSF page, but this is not working.
Get and set method is not called when I change the stat
The JSF page :
<p:inputSwitch value="#{SystemController.statSystem}" />
The managed bean
@ManagedBean
@ViewScoped
public class SystemController extends AbstractController implements Serializable {
private Boolean statSystem;
public Boolean getStatSystem() {
return statSystem;
}
public void setStatSystem(Boolean statSystem) {
this.statSystem=statSystem;
}
Upvotes: 0
Views: 2320
Reputation: 474
I added an ajax tag and it works ! Get and Set methods are working now.
<p:inputSwitch value="#{SystemController.statSystem}" >
<p:ajax />
</p:inputSwitch>
Upvotes: 2
Reputation: 2631
Your statSystem variable is not initialized. Init like:
private Boolean statSystem = false;
or instead change data type to primitive:
private boolean statSystem;
Upvotes: 0