You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by David Wilson <DW...@relevant.com> on 2004/10/28 22:45:12 UTC

Self assigned Dynamic Ids

Is it possible to do dynamic id generation using the Expression
language?

 

What I am trying to do is as follows...

            I have a dataTable that shows the lines. The section in the
line that show the product code I need to dynamically set the id so that
when the user clicks on a popup link the link can set the correct line
value.

 

This is a snippet of my code...

            <h:inputText id="#{EstimateBean.lineIndexId}"
required="true" value="#{EstimateBean.lineItem}">

            <j4j:idProxy id="itemId#{EstimateBean.lineIndex}" />

            <f:validateLength maximum="20" />

      </h:inputText>

 

I know that I can get the line number the current line in my backing
bean by using the DataModel's getRowIndex method. However, it looks like
my getLineIndexId method is never getting called to set the id in my
<h:inputText> element.

 

So basically it looks like the Expression language (EL) is not resolving
variables if the expression is in the id attribute.

 

Any suggestions?

 

Thank you,

David

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

David Wilson

dwilson@relevant.com

Staff Software Engineer

Relevant Business Systems

678-477-0007 ext. 8702

(Fax) 678-477-0010

 

Please send complaints to /dev/null

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

 


Re: Self assigned Dynamic Ids

Posted by Manfred Geiler <ma...@apache.org>.
David,
Yes, that's definitly true. JSF component ids are always static. This is 
a spec requirement.
Craig McClanahan gave a detailed answer to this issue some time ago. Try 
to find it in the list archive (note: the old list was 
myfaces-user@lists.sourceforge.net).

Manfred


David Wilson wrote:
> Is it possible to do dynamic id generation using the Expression language?
> 
>  
> 
> What I am trying to do is as follows…
> 
>             I have a dataTable that shows the lines. The section in the 
> line that show the product code I need to dynamically set the id so that 
> when the user clicks on a popup link the link can set the correct line 
> value.
> 
>  
> 
> This is a snippet of my code…
> 
>             <h:inputText id="#{EstimateBean.lineIndexId}" 
> required="true" value="#{EstimateBean.lineItem}">
> 
>             <j4j:idProxy id="itemId#{EstimateBean.lineIndex}" />
> 
>             <f:validateLength maximum="20" />
> 
>       </h:inputText>
> 
>  
> 
> I know that I can get the line number the current line in my backing 
> bean by using the DataModel’s getRowIndex method. However, it looks like 
> my getLineIndexId method is never getting called to set the id in my 
> <h:inputText> element.
> 
>  
> 
> So basically it looks like the Expression language (EL) is not resolving 
> variables if the expression is in the id attribute.
> 
>  
> 
> Any suggestions?
> 
>  
> 
> Thank you,
> 
> David
> 
> ********************************************************
> 
> David Wilson
> 
> dwilson@relevant.com
> 
> Staff Software Engineer
> 
> Relevant Business Systems
> 
> 678-477-0007 ext. 8702
> 
> (Fax) 678-477-0010
> 
>  
> 
> Please send complaints to /dev/null
> 
> ********************************************************
> 
>  
>