Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dynamic selectOneMenu

 
Bhaskar GR
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pls help me how to write dynamic selectOneMenu in backingBean
 
Dishpal Bhaluja
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Populating country field for example

<h:selectOneMenu>
<f:selectItemsValue="#{managedbean.country}"/>
</h:seleOneMenu>

In your managedbean
----------------------

public SelectItem[] country=
{ new SelectItem(new Integer(1),"India"}
new SelectItem(new Integer(2),"Pakistan"}
new SelectItem(new Integer(3),"Bangladesh"}
};

public SelectItem[] getCountry()
{
return country;
}

Thats all.Hope this will work for you.
 
Bhaskar GR
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Iam asking without writing jsp code,i have to write
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic