I'm dynamically building a HtmlSelectOneMenu as shown below. I need to build this component dynamically based on some Meta data and then set "6 mos" as the selected value on the dropdown list. How do i achieve this?
HtmlSelectOneMenu menu = new HtmlSelectOneMenu(); // combo box
// populate the drop down list
UISelectItems items = new UISelectItems();
I guess you will have to work out the dynamic list building part yourself, as far as set the "6 mos" as selected value
you will need to include value attribute in the <h:selectOneMenu> tag. The value attribute will point at the <managed-bean>'s prperty, so either you assign this property to "6 mos" or you assign this property based upon the dynamic list you generated for the drop-down if "6 mos" was not to be the selected value.