Passing a dynamic value as a key to a map in JSF 2.0

I have a list of keys that say "ListA". And the key map and list say "MapA". I need to repeat "ListA", and for each key I need to get its value from "MapA". And these values ​​serve as a model for dataTable.

For this purpose I use h: datatable inside ui: repeat.

<ui:repeat var="entry" value="#{bean.sampleDTO.sampleList}"
    varStatus="row">
    <tr>
        <td>#{entry.key}</td>
        <td><h:datatable value="#{bean.map[#{entry.key}]}" var="row">
                <h:column> 
                    // something
                </h:column>
            </h:datatable></td>
    </tr>
</ui:repeat>

Please note the datatable value:

value="#{bean.map[#{entry.key}]}"

The problem is that the key is a variable that I get from # {entry.key}. # {bean.map [# {entry.key}]} is an invalid EL expression because 2 # cannot be used.

Thank you Tarun Madaan

+5
source share
1 answer

for el expression: try this

value="#{bean.map[entry.key]}"

#{} #{}

+6

All Articles