3 Replies Latest reply on Aug 20, 2010 7:03 AM by amitev

    ValueExpressions in id attribute return null

    ziphyre

      Hi,


      I'm using seam 2.0.2 with facelets 1.1.14 and richafeces 3.2.1. My problem is I can't generate dynamic ids with EL.
      For example:


      <s:link id="message#{msg.id}" styleClass="message#{msg.Id}" />



      results in:


      <a id="message" class="message45" />



      As you can seen #{msg.id} is not null, since it evaluates to 45 in styleClass attribute.


      Some people have reported that they can and do generate dynamic ids with facelest 1.1.14 and JSF1.2


      I don't know how to troubleshoot this, since there is no error.
      Any help would be much appreciated...


      Thanks

        • 1. Re: ValueExpressions in id attribute return null
          flopsi
          Hi Marco,
          i have a similar problem. What i wanna do is generate an input field with dynamic id, but:

          <h:outputText value="#{obj.id}"/>            <- correctly rendered, e.g. 'DE'
          <h:inputText id="input_#{obj.id}" .../>      <- just rendered as 'input_', not 'input_DE'

          I know it's been a long time ago, but can you remember what was the solution?
          Maybe it isn't possible at all cos the id is rendered while rebuilding the component tree, and the object is not available that early?!?

          Another topic
          http://www.seamframework.org/Community/CreatingDynamicId
          also says dynamic ids are not possible, but if you say it is, did you find out how the guys managed it?

          Thanks a lot, best regards
          Flo
          • 2. Re: ValueExpressions in id attribute return null
            ziphyre

            Hi Flo,


            Unfortunately I don't have any solution for this, but also it's been a long time I quit working with Seam. Maybe some other people can answer your question.


            Regards

            • 3. Re: ValueExpressions in id attribute return null
              amitev

              The JSF specification doesn't allow dynamic id's of the components. With id as EL you can break the view.