Related to
this topic must read:
Support for the
Iterable interface in UIData and UIRepeat, by Arjan Tijms
Support for the Map interface in UIData and UIRepeat, by Arjan Tijms
Support for the Map interface in UIData and UIRepeat, by Arjan Tijms
Iterating in
UIData (e.g. <h:dataTable>)
JSF 2.0/2.1
- supports
the List,
native array and JSF specific DataModel as input for its value binding
- for Set only
(especially useful to Hibernate/JPA users, who are usually using the Set
collections for entity relationships)
you can use the OmniFaces function, of:setToList().
you can use the OmniFaces function, of:setToList().
- if EL 2.2
is available, for Iterable, you can use toArray() (e.g. #{fooBean.fooIterable.toArray()}).
- for Map you
can use the OmniFaces function, of:mapToList().
- if EL 2.2
is available, for Map, you can use toArray() (e.g. #{fooBean.fooMap.entrySet().toArray()}
or
#{fooBean.fooMap.keySet().toArray()}
or #{fooBean.fooMap.values().toArray()}).
or #{fooBean.fooMap.values().toArray()}).
JSF 2.2
- supports
the List,
native array and JSF specific DataModel as input for its value binding
- you can
use directly the Iterable (e.g. Set, Queue)
- for Map you
can use the OmniFaces function, of:mapToList().
- since Iterable
is directly supported, you can use it as
#{fooBean.fooMap.entrySet()} or #{fooBean.fooMap.keySet()}or
#{fooBean.fooMap.values()}
JSF
2.3
- supports
the List,
native array and JSF specific DataModel as input for its value binding
- you can
use directly the Iterable (e.g. Set, Queue)
- you can use Map directly
<h:dataTable
value="#{fooBean.fooMap}"
var="t">
#{t.key} #{t.value}
</h:dataTable>
Iterating in
UIRepeat (e.g. <ui:repeat>)
JSF 2.0/2.1/2.2
- supports
the List,
native array and JSF specific DataModel as input for its value binding
- for Set only
(especially useful to Hibernate/JPA users, who are usually using the Set
collections for entity relationships)
you can use the OmniFaces function, of:setToList().
you can use the OmniFaces function, of:setToList().
- if EL 2.2
is available, for Iterable, you can use toArray() (e.g. #{fooBean.fooIterable.toArray()}).
- for Map you
can use the OmniFaces function, of:mapToList().
- if EL 2.2
is available, for Map, you can use toArray() (e.g. #{fooBean.fooMap.entrySet().toArray()}
or
#{fooBean.fooMap.keySet().toArray()}
or #{fooBean.fooMap.values().toArray()}).
or #{fooBean.fooMap.values().toArray()}).
JSF
2.3
- supports
the List,
native array and JSF specific DataModel as input for its value binding
- you can use
directly the Iterable (e.g. Set, Queue)
<ui:repeat
value="#{fooBean.fooSet}"
var="t">
...
</ui:repeat>
- you can use Map directly
<ui:repeat
value="#{fooBean.fooMap}"
var="t">
#{t.key} #{t.value}
</ui:repeat>
Niciun comentariu :
Trimiteți un comentariu