【发布时间】:2015-02-16 02:57:08
【问题描述】:
我正在开发一个应用程序,我必须将它从 Glassfish v2 迁移到 Glassfish v3。该应用程序基于 IceFaces 框架。为此,我们还在 Icefaces 1.8.2 上切换到 Icefaces 3.3.0
在迁移之前它可以工作,但是现在当我生成数据表时,如果我刷新页面(通过单击应用程序中的按钮)而没有:
- 再次生成数据表(通过调用请求)
- 或者用这个 java 代码抑制它:resultatBinding.getChildren().clear();
总而言之,组件数据表在第一次使用时可以正常工作,但是如果我在页面中修改另一个 JSF 组件而不更改数据表,我会得到一个堆栈跟踪,开始于:
2014-12-16T10:27:26.449+0100|Grave: JSF1007 Duplicate component ID form : composite:j_ id123 found in view.
2014-12-16T10:27:26.449+0100|Grave: +id: j_id123
[…]
+id: j_id122
type: com.icesoft.faces.component.ext.UIColumn@76a457d5
+id: j_id123
type: com.icesoft.faces.component.ext.HtmlOutputText@1f829dcd
+id: j_id123
type: com.icesoft.faces.component.ext.HtmlOutputText@38460de4
+id: j_id124
type: com.icesoft.faces.component.ext.UIColumn@7f3a1098
+id: j_id125
type: com.icesoft.faces.component.ext.HtmlOutputText@3d17ac69
+id: j_id125
[…]
这就是数据表在 .xhtml 中的声明方式:
<ice:panelGroup styleClass="iceFrm" style="overflow: auto;width: 802px;max-width: 802px; height: 440px; max-height: 440px;" rendered="#{requeteurSql.baseDeDonnees != null}">
<ice:dataTable id="tableau" rendered="#{not empty requeteurSql.resultat}" value="#{requeteurSql.resultat}" var="currentRow" rows="#{requeteurSql.nbLigneResultat}" binding="#{requeteurSql.resultatBinding}">
<f:facet name="header">
<ice:columnGroup>
<ice:headerRow binding="#{requeteurSql.headerBinding}">
</ice:headerRow>
</ice:columnGroup>
</f:facet>
</ice:dataTable>
</ice:panelGroup>
这是无法理解的,因为尽管进行了迁移,但我并没有更改代码的语料库,而且它之前可以正常工作。正如 Icefaces 的文档所建议的,我将注释 @RequestScoped 交换为 @ViewScoped。但是我仍然有我的身份问题。 我觉得这是一种回归,但我不知道如何解决它。是不是我忘了设置一个参数?
有人知道吗?
提前致谢
【问题讨论】:
-
在 JSF 中,最好始终为
UIInput、UICommand和UIContainer组件分配 ID,例如<h:inputText>、<h:commandLink>、<h:dataTable>等。对 IceFaces 组件执行类似操作。