jsf - How to pre-select data in h:selectManyListbox -
this question has answer here:
this common problem , saw basic solution (populate selectmanylistbox
). here code of jsf 1.2 page:
<h:selectmanylistbox id="statusmenu" converter="statusconverter" value="#{aprvaction.ap.statuses}" > <f:selectitems id="statusitem" value="#{action.ap.statusitens}"/> <a:support event="onclick" ajaxsingle="true" immediate="true" eventsqueue="queuegeral" /> <a:support event="onchange" ajaxsingle="true" eventsqueue="queuegeral" process="statusmenu"/> </h:selectmanylistbox>
the thing #{aprvaction.ap.statuses}
instance of list<status>
class. however, in tag <f:selectitems>
value: #{action.ap.statusitens}
instance of list<selectitem>
.
i populate the #{aprvaction.ap.statuses}
values want pre-select listbox, did not work. think it's because different objects in <selectmanylistbox>
, <selectitems>
.
how can solve this, , show pre-selected values in <selectmanylistbox>
?
jsf use equals()
method compare available items (pre)selected items.
in case of standard objects, such string
, already implemented.
in case of custom objects, such status
entity, it's responsibility make sure you've implemented equals()
(and hashcode()
) method in class.
Comments
Post a Comment