0
와 데이터 테이블 : JSF 페이지JSF 내가 다음 코드 한 selectbooleancheckbox
<h:dataTablevalue="#{bean.records}" var="app">
<h:column>
<h:selectBooleanCheckbox value="#{bean.checked[app.id]}"/>
<f:facet name="footer">
<h:commandButton value="submit" action="#{bean.submitPublic}"/>
</f:facet>
</h:column>
와 콩 코드 : I 버튼을 클릭하면
@SessionScoped
public class bean
private Map<Long, Boolean> checked = new HashMap<Long, Boolean>();
private List<Application> checkedItems = new ArrayList<Application>();
public void submit() {
for (Application app : getRecords()) {
if (checked.get(app.getId())) {
checkedItems.add(app);
}
}
checked.clear();
//here logic for selected apps
}
public Map<Long, Boolean> getChecked() {
return checked;
}
public void setChecked(Map<Long, Boolean> checked) {
this.checked = checked;
}
문제는, 선택된 값이 제출되지 않습니다. 나는이 기사를 읽고 있었다 : How to use <h:selectBooleanCheckbox> in <h:dataTable> to select multiple rows?
모든 것을 동일한 방법으로했지만 작동하지 않는다.
잘 ... 작동했습니다. 고맙습니다. 내 코드가 왜 작동하지 않는지 설명해 주시겠습니까? –
제 설명을 드려서 죄송합니다. 'JSF 요청 처리 라이프 사이클 '을 배우십시오. – CycDemo