Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 4.0
-
Fix Version/s: EE-4.0.0.GA, 4.1
-
Component/s: ACE-Components, Sample Apps
-
Labels:None
-
Environment:ICEfaces4 trunk revision# 44061
Server: tomcat7.0.42
Browser: all
JSF: Myfaces v. 2.2.5 & 2.2.7
-
Assignee Priority:P2
-
Workaround Description:Removed the ID attribute for the _ace:column_ component in _dataTableDynamicColumns.xhtml_ to force Myfaces into assigning unique IDs to the created component instances.
Description
showcase built with MyFaces JSF > ace:dataTable > Dynamic Columns demo:
Server error & browser console error when clicking on dataTable "Dynamic Columns" menu link; demo page renders only after a browser refresh, but interaction with the page causes also a ViewExpiredException.
Browser console:
[window] [Tue, 17 Feb 2015 20:44:33 GMT] Error [status: malformedXML code: 200]: undefined
<partial-response><changes><update id="searchForm"><![CDATA[<form action="/showcase/showcase.jsf" enctype="application/x-www-form-urlencoded" id="searchForm" method="post" name="searchForm"><input autocomplete="off" name="ice.window" type="hidden" value="p4i69reirg" /><input autocomplete="off" name="ice.view" type="hidden" value="7i69reirg:18zr" /><script id="searchForm:searchForm_captureSubmit" type="text/javascript">i
Server error:
org.apache.myfaces.view.facelets.compiler.DuplicateIdException: Component with duplicate id "dynColF
orm:dataTable:columnHeader" found. The first component is {Component-Path : [Class: javax.faces.comp
onent.UIViewRoot,ViewId: /showcase.xhtml][Class: javax.faces.component.html.HtmlBody,Id: j_id_b][Cla
ss: javax.faces.component.html.HtmlPanelGroup,Id: container][Class: javax.faces.component.html.HtmlP
anelGroup,Id: __p][Class: javax.faces.component.html.HtmlPanelGroup,Id: __2p][Class: org.icefaces.ac
e.component.panel.Panel,Id: examplePanel][Class: javax.faces.component.html.HtmlPanelGroup,Id: __2s_
7][Class: javax.faces.component.html.HtmlForm,Id: dynColForm][Class: org.icefaces.ace.component.data
table.DataTable,Id: dataTable][Class: org.icefaces.ace.component.column.Column,Id: columnHeader]}
at org.apache.myfaces.view.facelets.compiler.CheckDuplicateIdFaceletUtils.createAndQueueExce
ption(CheckDuplicateIdFaceletUtils.java:152)
at org.apache.myfaces.view.facelets.compiler.CheckDuplicateIdFaceletUtils.checkIdsStatefulCo
mponents(CheckDuplicateIdFaceletUtils.java:60)
at org.apache.myfaces.view.facelets.compiler.CheckDuplicateIdFaceletUtils.checkIdsStatefulCo
mponents(CheckDuplicateIdFaceletUtils.java:82)
at org.apache.myfaces.view.facelets.compiler.CheckDuplicateIdFaceletUtils.checkIdsStatefulCo
mponents(CheckDuplicateIdFaceletUtils.java:82)
at org.apache.myfaces.view.facelets.compiler.CheckDuplicateIdFaceletUtils.checkIdsStatefulCo
mponents(CheckDuplicateIdFaceletUtils.java:82)
at org.apache.myfaces.view.facelets.compiler.CheckDuplicateIdFaceletUtils.checkIdsStatefulCo
mponents(CheckDuplicateIdFaceletUtils.java:82)
at org.apache.myfaces.view.facelets.compiler.CheckDuplicateIdFaceletUtils.checkIdsStatefulCo
Server error & browser console error when clicking on dataTable "Dynamic Columns" menu link; demo page renders only after a browser refresh, but interaction with the page causes also a ViewExpiredException.
Browser console:
[window] [Tue, 17 Feb 2015 20:44:33 GMT] Error [status: malformedXML code: 200]: undefined
<partial-response><changes><update id="searchForm"><![CDATA[<form action="/showcase/showcase.jsf" enctype="application/x-www-form-urlencoded" id="searchForm" method="post" name="searchForm"><input autocomplete="off" name="ice.window" type="hidden" value="p4i69reirg" /><input autocomplete="off" name="ice.view" type="hidden" value="7i69reirg:18zr" /><script id="searchForm:searchForm_captureSubmit" type="text/javascript">i
Server error:
org.apache.myfaces.view.facelets.compiler.DuplicateIdException: Component with duplicate id "dynColF
orm:dataTable:columnHeader" found. The first component is {Component-Path : [Class: javax.faces.comp
onent.UIViewRoot,ViewId: /showcase.xhtml][Class: javax.faces.component.html.HtmlBody,Id: j_id_b][Cla
ss: javax.faces.component.html.HtmlPanelGroup,Id: container][Class: javax.faces.component.html.HtmlP
anelGroup,Id: __p][Class: javax.faces.component.html.HtmlPanelGroup,Id: __2p][Class: org.icefaces.ac
e.component.panel.Panel,Id: examplePanel][Class: javax.faces.component.html.HtmlPanelGroup,Id: __2s_
7][Class: javax.faces.component.html.HtmlForm,Id: dynColForm][Class: org.icefaces.ace.component.data
table.DataTable,Id: dataTable][Class: org.icefaces.ace.component.column.Column,Id: columnHeader]}
at org.apache.myfaces.view.facelets.compiler.CheckDuplicateIdFaceletUtils.createAndQueueExce
ption(CheckDuplicateIdFaceletUtils.java:152)
at org.apache.myfaces.view.facelets.compiler.CheckDuplicateIdFaceletUtils.checkIdsStatefulCo
mponents(CheckDuplicateIdFaceletUtils.java:60)
at org.apache.myfaces.view.facelets.compiler.CheckDuplicateIdFaceletUtils.checkIdsStatefulCo
mponents(CheckDuplicateIdFaceletUtils.java:82)
at org.apache.myfaces.view.facelets.compiler.CheckDuplicateIdFaceletUtils.checkIdsStatefulCo
mponents(CheckDuplicateIdFaceletUtils.java:82)
at org.apache.myfaces.view.facelets.compiler.CheckDuplicateIdFaceletUtils.checkIdsStatefulCo
mponents(CheckDuplicateIdFaceletUtils.java:82)
at org.apache.myfaces.view.facelets.compiler.CheckDuplicateIdFaceletUtils.checkIdsStatefulCo
mponents(CheckDuplicateIdFaceletUtils.java:82)
at org.apache.myfaces.view.facelets.compiler.CheckDuplicateIdFaceletUtils.checkIdsStatefulCo
This problem turns out to be a bug in Myfaces. More precisely org.apache.myfaces.view.facelets.tag.jsf.ComponentTagHandlerDelegate who creates and adds the components into the component tree doesn't know to assign unique IDs to the components when the tag handler is included in a c:forEach tag. In Mojarra com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl knows how to avoid this problem. Here's the inline comment found in the relevant block of code: