[英]Events not fired from <h:selectBooleanCheckbox> in JSF 2
我的JSF2项目中存在一些有问题的行为。
我有一个下拉框h:selectOneMenu
,它会在onchange = "submit();"
页面上触发刷新onchange = "submit();"
依次导致我的h:dataTable
带有复选框h:selectBooleanCheckbox
。
问题是我没有从复选框中获取所有 ValueChangeEvent
事件-我仅获得与初始下拉选择中的复选框一样多的事件。 例如:
setNodeState
事件。 MultiFileSelectMgmtBean.fileNames
。 我选中所有复选框。 setNodeState
事件,而不是我期望的10个事件。 这是xhtml代码:
<tr>
<td>
<h:selectOneMenu
value = "#{MultiFileSelectMgmtBean.selectedLocationId}"
valueChangeListener = "#{MultiFileSelectMgmtBean.LocationChangeEvent}"
onchange = "submit();"
styleClass = "text" style="width: 250px;">
<f:selectItems
value = "#{MultiFileSelectMgmtBean.locationsListItems}"
var = "location"
itemValue = "#{location}"
itemLabel = "#{location.label}">
</f:selectItems>
</h:selectOneMenu>
</td>
</tr>
<tr>
<td>
<h:dataTable value="#{MultiFileSelectMgmtBean.fileNames}" var="filename">
<h:column>
<h:selectBooleanCheckbox value = "#{MultiFileSelectMgmtBean.fileMap[filename]}"
valueChangeListener = "#{MultiFileSelectMgmtBean.setNodeState}"
title = "#{filename}"
/>
<h:outputText value="#{filename}" styleClass="text"/>
</h:column>
</h:dataTable>
</td>
</tr>
问题是支持bean的构造方法。 我总是使用第一个选择来初始化下拉框。 然后,该事件会将其更改为其他选择。
现在,我将下拉菜单的状态保存为会话变量。 创建bean时,它首先检查此状态是否已保存,如果是,则加载它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.