jsf - Pushing a value from inside <ui:repeat> in a map, set or list -
i know if possible push value inside map, set or list?
i pass value of inputtext 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 set ???}"/> <br /><br /> </ui:repeat>
regards markus
with set
, not possible doesn't allow referencing items index or key. it's possible list
, map
specifying list index , map key in input value.
with list
:
private list<string> list; // +getter (no setter necessary) @postconstruct public void init() { list = createandfillitsomehow(); }
<ui:repeat value="#{bean.list}" varstatus="loop"> <h:inputtext value="#{bean.list[loop.index]}" /> </ui:repeat>
with map
(only if environment supports el 2.2 or jboss el):
private map<string, string> map; // +getter (no setter necessary) @postconstruct public void init() { map = createandfillitsomehow(); }
<ui:repeat value="#{bean.map.entryset().toarray()}" var="entry"> <h:inputtext value="#{bean.map[entry.key]}" /> </ui:repeat>
noted should canonical approach use list
of fullworthy javabeans. let's assume javabean class named par
properties id
, value
maps par
table in db columns id
, value
:
private list<par> pars; // +getter (no setter necessary) @postconstruct public void init() { pars = createandfillitsomehow(); }
<ui:repeat value="#{bean.pars}" var="par"> <h:inputtext value="#{par.value}" /> </ui:repeat>
either way, works when using <p:inputtext>
, it's in no way related primefaces, it's in context of question merely jquery based jsf ui component library. replace h:
p:
turn on.
Comments
Post a Comment