My xhtml file contains the code where someMB.allQuestions returns a list of object of Questions class.
<c:forEach items="#{someMB.allQuestions}" var="question">
<h:outputText value="#{question.name}" />
<h:selectBooleanCheckbox value="#{myBean.isChecked}">
<f:ajax listener="#{myBean.addQuestion(question)}" />
</h:selectBooleanCheckbox>
</c:forEach>
My Bean code is:
private boolean isChecked;
HashSet<Questions> totalQuestions = new HashSet<>();
// getter setter
public string addQuestion(Questions questions){
if(isChecked){
totalQuestions.add(questions);
}
}
Here addQuestion() method is not called. but if I remove the parameter and call the method without argument then it works. I don't know why. Can anybody give me a solution about calling with parameter.