[jboss-user] [JBoss Tools] - population a selectOneMenu Dynamically

yasser zairi do-not-reply at jboss.com
Tue Jul 26 06:34:24 EDT 2011


yasser zairi [http://community.jboss.org/people/yasser_z] created the discussion

"population a selectOneMenu Dynamically"

To view the discussion, visit: http://community.jboss.org/message/617590#617590

--------------------------------------------------------------
Hi, 
i want to populate a selectOneMenu Dynamically from my Bean, i used a map(id, value) but it populate my selectOneMenu with the ids not the values ,
here is the selectOneMenu: 
_________________________________________________________________
<h:selectOneMenu id="select_cat">
         <f:selectItem itemLabel="--categorie"/>
         <f:selectItems value="#{valeursMBean.categories}"/>
</h:selectOneMenu>
__________________________________________________________________
here is the code of my Bean: 
__________________________________________________________________

private transient ValeurRefService valeurefService;
private Map<String,Integer> categories = new HashMap<String,Integer>();

@PostConstruct
    public void init(){

         valeurefList = valeurefService.find();

         categories.clear();

         for (ValeurRef m : valeurefList) {
             categories.put(m.getIdValeurRef(),m.getCategorie());
         }

    }
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/617590#617590]

Start a new discussion in JBoss Tools at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2128]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110726/07cdd6dc/attachment.html 


More information about the jboss-user mailing list