JV,

From what I understand, setting component ids dynamically through EL is disallowed.

There has been discussion of this, which can be found in the archives. Here is one example, see [1](tiny url) or [2](full url).

[1] http://tinyurl.com/2o4bal
[2] http://mail-archives.apache.org/mod_mbox/myfaces-users/200410.mbox/[EMAIL PROTECTED]

Jorge Vásquez wrote:
Regards to all,

I haven’t been able to establish different id’s for a HTMLCommandLink
components inside a list.

I have tried the following 2 scenarios with the respective result:

1.                                         <ui:repeat
value="#{toolTabBean.toolbarElementList}" var="toolbarElement">

                                               <td>

                                                     <t:commandLink
id="#{toolbarElement.id}" forceId="true"
action="#{toolTabBean.toolbarElementActionDelegate}" styleClass="link">

                                                           <h:graphicImage
value="#{toolbarElement.imagePath}" alt="#{toolbarElement.altText}"
title="#{toolbarElement.toolTipText}" styleClass="borderLessImage"/>

                                                           <h:outputText
value="  " />

                                                           <f:param
name="toolElementId" value="#{toolbarElement.id}" />

                                                     </t:commandLink>

</td>
                                         </ui:repeat>

RESULT:  I get the exception:  java.lang.IllegalArgumentException: component
identifier must not be a zero-length String
        at
javax.faces.component.UIComponentBase.isIdValid(UIComponentBase.java:1034)
        at
javax.faces.component.UIComponentBase.setId(UIComponentBase.java:274)

………etc…..

****************************************************************************
****************

2.                                         <ui:repeat
value="#{toolTabBean.toolbarElementList}" var="toolbarElement">

                                               <td>

                                                     <t:commandLink
id="#{toolbarElement eq null ? 'trialId' : toolbarElement.id}"
forceId="true" action="#{toolTabBean.toolbarElementActionDelegate}"
styleClass="link">

                                                           <h:graphicImage
value="#{toolbarElement.imagePath}" alt="#{toolbarElement.altText}"
title="#{toolbarElement.toolTipText}" styleClass="borderLessImage"/>

                                                           <h:outputText
value="  " />

                                                           <f:param
name="toolElementId" value="#{toolbarElement.id}" />

                                                     </t:commandLink>

</td>
                                         </ui:repeat>

RESULT:  All the rendered anchor (<a>) elements in html end up having the
same id:  trialId

****************************************************************************
****************

I need to be able to have each commandLink rendered with a specific Id as in
specific situations I reference certain commands through javascript
code…making use of their ids.

Any idea on how can I accomplish this?

Thanks and regards,

JV




Reply via email to