File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Android Security Essentials Live Lessons this week in the Android 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
 
Similar Threads
WA #1.....word association
How to set Default selection in h:selectOneMenu
h:datatable+selctonemenu problem
JSF: HtmlSelectOneMenu and getting the values
Question on list values set on bean