How can I set component / tag id inside user interface: repeat

I am trying to assign idfor a component inside <ui:repeat>as follows:

<ui:repeat value="#{bean.columns}" var="column">
    <h:panelGroup layout="block" id="column_#{column.id}" 
        styleClass="#{column.id} dashboard_column">

The fact is that the value is #{column.id}correctly placed inside the value styleClassbut is not set inside the attribute id. All that is set inside the attribute idis idmy hard-coded value automatically generated using JSF + column_.

If I am column_hard-coded column_I get an exception:

java.lang.IllegalArgumentException: component identifier should not be a zero-length string in

Any ideas?

+8
source share
2 answers

, <ui:repeat>. <ui:repeat> , . EL ID .

<ui:repeat value="#{bean.columns}" var="column">
    <h:panelGroup layout="block" id="column">

, <c:forEach> ( <h:panelGroup> , ), .

<c:forEach items="#{bean.columns}" var="column">
    <h:panelGroup layout="block" id="column_#{column.id}">

( , JSTL Facelets)

<div> JSF <h:panelGroup layout="block">.

<ui:repeat value="#{bean.columns}" var="column">
    <div id="column_#{column.id}">

:

+12

JSF . id = "column", HTML :

MyForm: 0: MyForm: 1: MyForm: 2:

..

: JSTL (, c: foreach c: if) JSF. , . , .

ui: repeat ui: . , c: set, JSF 2.

+6

All Articles