Tony
Tony

Reputation: 2406

Duplicate id error with primefaces dialog in template

PF 3.5.10, Mojara 2.1.21, Omnifaces 1.5

I have Facelet-Template with p:menu and p:include for dialog

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:

<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:

 <ui:composition template="/app/mytemplate.xhtml">
    <ui:define name="content">
    <h:form> ... </h:form>
    </ui:define>
 </ui:composition>

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 <<========

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 ?

Upvotes: 1

Views: 1868

Answers (1)

Tony
Tony

Reputation: 2406

The prolbem was binding attribute on datatable. See also: Binding attribute causes duplicate component ID found in the view

SessionScoped component was used in multiple views.

I've used EL-table binding and then the problem was disappeared.

Upvotes: 3

Related Questions