我正在为我的应用程序使用 ICEFaces 1.8。我在这样的网格中有一些 SelectInputText:
<ice:panelGrid columns="4">
<ice:selectInputText id="txtId"
valueChangeListener="#{employeeBean.searchIdListener}" partialSubmit="true"></ice:selectInputText>
<ice:selectInputText id="txtFirstName"
valueChangeListener="#{employeeBean.searchFirstNameListener}" partialSubmit="true"></ice:selectInputText>
<ice:selectInputText id="txtLastName"
valueChangeListener="#{employeeBean.searchLastNameListener}" partialSubmit="true"></ice:selectInputText>
<ice:selectInputText id="txtPhoneNumber"
valueChangeListener="#{employeeBean.searchPhnNbrListener}" partialSubmit="true"></ice:selectInputText>
</ice:panelGrid>
当我更改上述任何一个 SelectInputText 的值时,我可以看到上述所有四个 ValueChangeListener 方法都在执行 - 为什么?
难道不应该只是执行的方法的 SelectInputText 有一些值变化吗?
请让我知道这件事。
最佳答案
这可能是因为 <ice:selectInputText>
初始值为 NULL,第一次部分或全部提交将导致从页面提交 EMPTY 字符串。
使用空字符串初始化您的 selectInputText 以避免这种情况,或者您可以在 JSF 2.x 中添加以下内容,
<context-param>
<param-name>
javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL
</param-name>
<param-value>true</param-value>
</context-param>
还要补充一下Icefaces,它的partial submit有点困惑。 它更像是带有部分 Ajax/DOM 呈现的完整 Ajax 提交。有几种情况 icefaces 1.8 会在页面上执行多个组件,但是它在数据表列、panelSeries 等中避免了它。
关于java - IceFaces 1.8 中的 SelectInputText ValueChangeListener 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16168294/