与模板中的原子对话框重复出现ID错误 [英] Duplicate id error with primefaces dialog in template
问题描述
PF 3.5.10,Mojara 2.1.21,Omnifaces 1.5
PF 3.5.10, Mojara 2.1.21, Omnifaces 1.5
我有Facelet-Template with p:menu和p:include for dialog
I have Facelet-Template with p:menu and p:include for dialog
mytemplate.xhtml:
mytemplate.xhtml:
<h:form> ... <p:menubar>
<p:menuitem value="Start Dialog" oncomplete="mydialogwidget.show()"/>
<p:menuitem value="open another page" action="/app/mypage.xhtml?faces-redirect=true"/>
</p:menubar> ... </h:form>
<ui:insert name="content" />
<ui:include="/app/mydialog.xhtml" />
mydialog.xhtml:
mydialog.xhtml:
<ui:composition>
<p:dialog widgetVar="mydialogwidget" ...>
<h:form>
<p:datatable binding="#{mybean.table}">
<p:column id="col_first"> ... </p:column>
...
<p:column id="col_last"> ... </p:colum>
</p:datatable>
</h:form>
</p:dialog>
</ui:composition>
mypage.xhtml:
mypage.xhtml:
<ui:composition template="/app/mytemplate.xhtml">
<ui:define name="content">
<h:form> ... </h:form>
</ui:define>
</ui:composition>
如果我启动mypage.xhtml表单,我将成为JSF1007错误(复制ids)组件树将写在我的控制台上简化的组件树输出:
If I start mypage.xhtml form menue, I become JSF1007 error (Duplicate ids) The component tree will be written to my console. The simplified component tree output:
+id: mydialog
+id: mytable
+id: col_first <<=============
....
+id: col_last
+id:col_first <<========
mydialog.xhtml
将仅包括一次。问题的答案具有Primefaces菜单重复Id错误的JSF 不帮助我
我该如何避免这个错误?这个错误从哪里来?
The mydialog.xhtml
will be included only once. The answer to question JSF with Primefaces Menu duplicate Id error? doesn't help me.
How can I aviod this error ? Where comes this error from ?
推荐答案
这个prolbem是datatable上的绑定属性。另请参见:绑定属性导致在视图中找到重复的组件ID
The prolbem was binding attribute on datatable. See also: Binding attribute causes duplicate component ID found in the view
SessionScoped组件在多个视图中使用。
SessionScoped component was used in multiple views.
我使用EL表绑定,然后问题消失了。
I've used EL-table binding and then the problem was disappeared.
这篇关于与模板中的原子对话框重复出现ID错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!