【发布时间】:2017-12-28 10:17:45
【问题描述】:
所以,这里是 jsf 组件:
<h:selectBooleanCheckbox id="cb#{index}" value="backingBean.value" />
这是支持bean java的一部分:
/**
* getValue is a method which checks if a checkbox is selected or not, using the checkbox ID
*/
public boolean getValue() {
//TODO: get the checkbox id
String checkboxID = ??
if (getCheckedIDs().contains(checkboxID)) {
return true;
}
return false;
}
当页面加载复选框时,我想以这种方式检查复选框是否被选中。 那么问题来了,要写什么而不是 ?? 来获取调用该方法的复选框的 ID? 我只能使用 JSF 1.1 非常重要,因此有很多解决方案不适用于此版本。
【问题讨论】:
-
value="backingBean.value"错误...应该是`value="#{backingBean.value}"