Hmmm, why not update to facelets 1.14, i have both myfaces 1.1.3 and facelets 1.1.4 and i don't get dup ids anymore.

On 4/14/06, Andrew Robinson < [EMAIL PROTECTED]> wrote:
I am having duplicate ID problems still in MyFaces 1.1.3 on a really
complex page.

Environment: MyFaces 1.1.3, Tomahawk 1.1.2, Facelets 1.0.12

This problem is killing our development. I'm getting to the point
where I feel like I may have to hack MyFaces and create a new view
root or view handler to assign my own IDs (How does MyFaces assign
IDs? Shouldn't it keep an integer in the requestmap so that it
guarantees a unique ID per request or something equivalent?). We are
on an insane timeline and don't have the option to make radical
changes now unfortunately (like switch to the RI).

Page structure (included only the important items as these files are
around 500 lines of JSF code):

page.xhtml:
<ui:composition template=" template.xhtml">
</ui:composition>

template.xhtml:
<ui:composition>
  <ui:decorate template="innerFile.xhtml">
     <ui:define name="body" />
  </ui:decorate>
</ui:composition>

innerFile.xhtml:
<ui:composition>
  <ost:actionPane />
</ui:composition>

Where action pane is defined as:
  <tag>
    <tag-name>actionPane</tag-name>
    <source>tags/actionPane.xhtml</source>
  </tag>

actionPane.xhtml:
<ui:composition>
  <ui:include src="" />
  <ui:decorate template="controls/memberSelector.xhtml">
     <ui:param name="dialogId" value="currentViewMemberSelector" />
  </ui:decorate>
</ui:composition>

controls/memberSelector.xhtml:
<ui:composition>
  <ost:dialog dialogId="#{dialogId}">
  ... ( A lot of controls ) ...
    <t:dataTable>
      <t:column rendered="#{dlgBean.currentElemView != 'DESC_ONLY'}"
        id="#{dialogId}IdColumn"
        styleClass="#{ dlgBean.selectedMemberId eq member.id ?
          'selectedCol' : 'col' }">
        <f:facet name="header">
          <t:commandSortHeader columnName="ID" arrow="true"
            id="#{dialogId}IdColumnHeader"
            >            <f:param name="ajaxZone"
              value="#{dialogId}DataZone" />
            <f:actionListener type="com.faces.AjaxBean" />
            <t:outputText value="#{msg.dimmemberdlg_showdataview_id}" />
          </t:commandSortHeader>
        </f:facet>
        <t:outputText value="#{member.id}" />
      </t:column>
  ... ( A lot of controls ) ...
   </ost:dialog>
</ui:composition>

Where dialog is defined as:
  <tag>
    <tag-name>dialog</tag-name>
    <source>tags/dialog.xhtml</source>
  </tag>

I have put in the entire XHTML content of the one column as this is
where I am getting the duplicate ID.

It is important to note that all of our pages are using this complex
template as it creates our application template with a bunch of
dialogs, toolbars, etc. Not all the pages are having the problem, only
certain ones (seemingly at random). However, I am getting the error in
the same place each time.

Instead of "<t:outputText value="#{msg.dimmemberdlg_showdataview_id}"
/>" I used to have "#{ msg.dimmemberdlg_showdataview_id}", and although
I got an error in both situations, it was slightly different.

With the inline EL text, I got the following error (a portion from the
facelets component tree print out):
<HtmlSimpleColumn
header="[EMAIL PROTECTED]"
id="currentViewMemberSelectorIdColumn" rendered="true"
styleClass="selectedCol" transient="false">
header
<HtmlCommandSortHeader arrow="true" columnName="ID" disabled="false"
id="currentViewMemberSelectorIdColumnHeader" immediate="false"
rendered="true" transient="false">
<UIParameter id="_id80" name="ajaxZone" rendered="true" transient="false"
value="currentViewMemberSelectorDataZone"/>
</HtmlCommandSortHeader>
<HtmlOutputText escape="true" id="_id80" rendered="true" transient="false"/>
</HtmlSimpleColumn>
As you can see, _id80 has been used twice.

With replacing the EL with the <t:outputText /> (to see if it was an
inline EL issue), I got a different error in the same place:
<     <ui:define name="body" />
  </ui:decorate>
</ui:composition>

innerFile.xhtml:
<ui:composition>
  <ost:actionPane />
</ui:composition>

Where action pane is defined as:
  <tag>
    <tag-name>actionPane</tag-name>
    <source>tags/actionPane.xhtml</source>
  </tag>

actionPane.xhtml:
<ui:composition>
  <ui:include src="" />
  <ui:decorate template="controls/memberSelector.xhtml">
     <ui:param name="dialogId" value="currentViewMemberSelector" />
  </ui:decorate>
</ui:composition>

controls/memberSelector.xhtml:
<ui:composition>
  <ost:dialog dialogId="#{dialogId}">
  ... ( A lot of controls ) ...
    <t:dataTable>
      <t:column rendered="#{dlgBean.currentElemView != 'DESC_ONLY'}"
        id="#{dialogId}IdColumn"
        styleClass="#{dlgBean.selectedMemberId eq member.id ?
          'selectedCol' : 'col' }">
        <f:facet name="header">
          <t:commandSortHeader columnName="ID" arrow="true"
            id="#{dialogId}IdColumnHeader"
            >            <f:param name="ajaxZone"
              value="#{dialogId}DataZone" />
            <f:actionListener type="com.faces.AjaxBean " />
            <t:outputText value="#{msg.dimmemberdlg_showdataview_id}" />
          </t:commandSortHeader>
        </f:facet>
        <t:outputText value="#{ member.id}" />
      </t:column>
  ... ( A lot of controls ) ...
   </ost:dialog>
</ui:composition>

Where dialog is defined as:
  <tag>
    <tag-name>dialog</tag-name>
    <source>tags/dialog.xhtml</source>
  </tag>

I have put in the entire XHTML content of the one column as this is
where I am getting the duplicate ID.

It is important to note that all of our pages are using this complex
template as it creates our application template with a bunch of
dialogs, toolbars, etc. Not all the pages are having the problem, only
certain ones (seemingly at random). However, I am getting the error in
the same place each time.

Instead of "<t:outputText value="#{msg.dimmemberdlg_showdataview_id}"
/>" I used to have "#{msg.dimmemberdlg_showdataview_id}", and although
I got an error in both situations, it was slightly different.

With the inline EL text, I got the following error (a portion from the
facelets component tree print out):
<HtmlSimpleColumn
header="[EMAIL PROTECTED] "
id="currentViewMemberSelectorIdColumn" rendered="true"
styleClass="selectedCol" transient="false">
header
<HtmlCommandSortHeader arrow="true" columnName="ID" disabled="false"
id="currentViewMemberSelectorIdColumnHeader" immediate="false"
rendered="true" transient="false">
<UIParameter id="_id80" name="ajaxZone" rendered="true" transient="false"
value="currentViewMemberSelectorDataZone"/>
</HtmlCommandSortHeader>
<HtmlOutputText escape="true" id="_id80" rendered="true" transient="false"/>
</HtmlSimpleColumn>


As you can see, _id80 has been used twice.


With replacing the EL with the <t:outputText /> (to see if it was an
inline EL issue), I got a different error in the same place:

    <HtmlCommandSortHeader arrow="true" columnName="ID"
disabled="false" id="currentViewMemberSelectorIdColumnHeader"
immediate="false" rendered="true"
transient="false">
        <UIParameter id="_id80" name="ajaxZone" rendered="true"
transient="false" value="currentViewMemberSelectorDataZone"/>
        <HtmlOutputText escape="true" id="_id81" rendered="true"
transient="false" value="ID"/>
    </HtmlCommandSortHeader>
    <HtmlOutputText escape="true" id="_id81" rendered="true" transient="false"/>
</HtmlSimpleColumn>

This time _id81 was duplicated. This happens every time I hit this
same page. In both instances, there was a conflict of a component in
the sort header component with the output text outside of the sort
header.

I am not sure what to do here. Our UI for our application is extremely
complex and I need the templating capabilities I am using. I can
possibly tone down on some of the facelets includes producing one
gigantic XHTML file, but I cannot get rid of all of them. I am doing
the following in some places:

<c:choose>
<c:when test="#{condition a}">
<tags>
<ui:decorate template="..." />
</tags>
</c:when>
<c:otherwise>
<ui:decorate template="..."/>
</c:otherwise>
</c:choose>

So in these instances, I am creating different parent tags for
included source based on a parameter passed in from the including file
(By the way, this parameter never changes on a given page, so the
when/otherwise will always be evaluated the same for each page).

The page that is dying is on the first render of the page (a brand new
component tree). So it is not an issue of post back and restoring the
view, etc.

Here is the stack trace:
java.lang.IllegalStateException: Client-id : _id81 is duplicated in
the faces tree. Component : zfpForm:_id79:_id81, path: {Component-Path
: [Class: javax.faces.component.UIViewRoot,ViewId:
/pages/Admin/Appsets/Dimension/dim_view.xhtml][Class:
javax.faces.component.html.HtmlForm,Id: zfpForm][Class:
org.ajaxanywhere.jsf.ZoneUIComponent,Id: actionPaneZone][Class:
org.apache.myfaces.custom.div.Div,Id:
currentViewMemberSelector][Class:
org.ajaxanywhere.jsf.ZoneUIComponent,Id:
currentViewMemberSelectorDialogZone][Class:
com.outlooksoft.cpm.faces.controls.HtmlGridBagPanel ,Id:
_gridBagPanelID_2][Class:
com.outlooksoft.cpm.faces.controls.HtmlGridBagCell,Id:
_gridBagCellID_3][Class: org.ajaxanywhere.jsf.ZoneUIComponent,Id:
currentViewMemberSelectorDataZone][Class:
org.apache.myfaces.component.html.ext.HtmlDataTable ,Id: _id79][Class:
org.apache.myfaces.custom.column.HtmlSimpleColumn,Id:
currentViewMemberSelectorIdColumn][Class:
org.apache.myfaces.component.html.ext.HtmlOutputText,Id: _id81]}
        at org.apache.myfaces.application.jsp.JspStateManagerImpl.checkForDuplicateIds (JspStateManagerImpl.java:350)
        at org.apache.myfaces.application.jsp.JspStateManagerImpl.checkForDuplicateIds(JspStateManagerImpl.java:365)
        at org.apache.myfaces.application.jsp.JspStateManagerImpl.checkForDuplicateIds (JspStateManagerImpl.java:361)
        at org.apache.myfaces.application.jsp.JspStateManagerImpl.checkForDuplicateIds(JspStateManagerImpl.java:365)
        at org.apache.myfaces.application.jsp.JspStateManagerImpl.checkForDuplicateIds (JspStateManagerImpl.java:365)
        at org.apache.myfaces.application.jsp.JspStateManagerImpl.checkForDuplicateIds(JspStateManagerImpl.java:365)
        at org.apache.myfaces.application.jsp.JspStateManagerImpl.checkForDuplicateIds (JspStateManagerImpl.java:365)
        at org.apache.myfaces.application.jsp.JspStateManagerImpl.checkForDuplicateIds(JspStateManagerImpl.java:365)
        at org.apache.myfaces.application.jsp.JspStateManagerImpl.checkForDuplicateIds (JspStateManagerImpl.java:365)
        at org.apache.myfaces.application.jsp.JspStateManagerImpl.checkForDuplicateIds(JspStateManagerImpl.java:361)
        at org.apache.myfaces.application.jsp.JspStateManagerImpl.checkForDuplicateIds (JspStateManagerImpl.java:365)
        at org.apache.myfaces.application.jsp.JspStateManagerImpl.saveSerializedView(JspStateManagerImpl.java:305)
        at org.jboss.seam.jsf.SeamPhaseListener$StateManagerInterceptor.saveSerializedView (SeamPhaseListener.java:210)
        at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:471)
        at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:367)

Thanks,
Andrew



--
Yours truly (Atenciosamente),

Rogério

Reply via email to