Search code examples
jsfjsf-2foreachicefaces

how to get value of individual component within c:foreach?


I have used c:foreach to iterate and display my inputtext where each inputtext has unique id, how do i get the individual id of the particular component or the one which user selected?

<c:forEach items="${gapMatch.text}" var="fill">
    <ice:outputText value="${fill.outputText}" />   
    <ice:inputText id="${fill.inputText}" onclick="popup.show();" >
</c:forEach>

I need this input text id in my managed bean.


Solution

  • I don't know if this is what you need but you could write a javascript function like this

    function fun(id){  
         document.getElementById(id) etc
    }
    
    
    <ice:inputText id="${fill.inputText}" onclick="popup.show();"
    onblur="fun(this.id);">
    

    you can also bind your component to your backing bean and get the id.