After upgrading to MyFaces 1.2.2 I am getting a “duplicate id in the faces
tree” error.  I have isolated it to the following section of code:

<t:column id="${fieldName}" styleClass="${columnStyleClass}"
rendered="${renderValue}">

  <f:facet name="header">
    <t:commandSortHeader columnName="${fieldName}" arrow="true"
        actionListener="#{backingBean.sortChanged}"
        immediate="true"
        styleClass="cellDataHeader">
      ${label}
    </t:commandSortHeader>
  </f:facet>
  
  <c:choose>
    ...
    ...
    <c:when test="${empty secondaryFieldName}">
    
      <c:if test="${not empty linkAction}">
        <h:commandLink action="#{backingBean.details}" immediate="true">
          <c:choose>
            <c:when test="${not empty dateFormat}">
              <h:outputText value="${entity[fieldName]}">
                <f:convertDateTime type="date" timeZone="${timeZone}"
                  dateStyle="${dateFormat}" 
                  pattern="${datePattern}" />
              </h:outputText>
            </c:when>
            
            <c:when test="${not empty currencyPattern}">
              <h:outputText value="${entity[fieldName]}">
                <f:convertNumber pattern="${currencyPattern}" />
              </h:outputText>
              <br />
            </c:when>
            
            <c:otherwise>
              <h:outputText value="${entity[fieldName]}" />
            </c:otherwise>
          </c:choose>
          
          <f:param name="itemType" value="${linkAction}" />
          <f:param name="fieldName" value="${fieldName}" />
          <f:param name="addParam" value="${addParam}" />
        </h:commandLink>

The sections marked in bold indicate the components for which duplicate ids
are being generated.  I should also mention we are using facelets + xhtml,
and the code listed above is in a facelet that is being invoked from the
main page.

Reading some previous posts is seems the problem is most likely caused by
mixing JSTL and JSF tags; ideally I would want to remove the JSTL tags, but
the facelet in question was not written by me and is quite long so I would
only want to do this as a last resort.

My question is: can anyone suggest an alternative solution to rewriting the
facelet without JSTL tags? I realize I could also solve this issue by
explicitly naming the components but would like to understand better how the
auto id generation works in MyFaces.

Also, if the only "right" solution is to remove the JSTL tags, can someone
suggest how to do this, considering they appear to be used extensively
(c:if, c:when…)?

Thanks in advance to anyone who can assist.

Mihajlo
-- 
View this message in context: 
http://www.nabble.com/Duplicate-id-in-faces-tree-error---removing-JSTL--tp16941806p16941806.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.

Reply via email to