This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes JSF and the fly likes Dynamic selectOneMenu Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Dynamic selectOneMenu" Watch "Dynamic selectOneMenu" New topic
Author

Dynamic selectOneMenu

Bhaskar GR
Greenhorn

Joined: Jun 13, 2008
Posts: 28
Pls help me how to write dynamic selectOneMenu in backingBean
Dishpal Bhaluja
Ranch Hand

Joined: Dec 30, 2007
Posts: 96
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

Joined: Jun 13, 2008
Posts: 28
Iam asking without writing jsp code,i have to write
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Dynamic selectOneMenu
 
It's not a secret anymore!