I would like to know if it possible to push a value from inside a <ui:repeat>
to a map, a set or a list?
I would like to pass the value of the <h:inputtext>
to a set.
Code:
<ui:repeat var="_par" value="#{cmsFilterParameterHandler.normaleSuchParameter()}">
<p:outputLabel value="#{_par.bezeichnung}" />
<p:spacer width="5px" />
<p:inputText id="me" value="#{??? push me to a set ???}"/>
<br /><br />
</ui:repeat>
With a
Set
, it is not possible as it doesn't allow referencing items by index or key. It's however possible with aList
and aMap
by just specifying the list index and map key in the input value.With a
List
:With a
Map
(only if your environment supports EL 2.2 or JBoss EL):Noted should be that the canonical approach is to use a
List
of fullworthy javabeans. Let's assume a Javabean class namedPar
with propertiesid
andvalue
which maps exactly to apar
table in DB with columnsid
andvalue
:Either way, it works as good when using
<p:inputText>
, it's in no way related to PrimeFaces, it's in the context of this question merely a jQuery based JSF UI component library. Just replaceh:
byp:
to turn it on.I'm not sure, if I understood your requirements correctly. I suppose the following: You need a List of Strings in some backend and an
ui:repeat
tag to iterate over those strings with input-fields to edit them. Maybe there are some syntax-issues, but my idea should be clear:In the frontend you use as follows:
Of course, you have to provide a getIndexSequence-method which produces a list of ints ranging from 0 to the size of the strings.
Do you mean like this?
in BackBean: