JSF selectOneMenu example : The h:selectOneMenu tag renders an HTML input element of the type “select” with size not specified.

JSF Tag

<h:selectOneMenu value = "#{userData.data}"> 
   <f:selectItem itemValue = "1" itemLabel = "Item 1" /> 
   <f:selectItem itemValue = "2" itemLabel = "Item 2" /> 
</h:selectOneMenu> 

Rendered Output

<select name = "j_idt6:j_idt8">  
   <option value = "1">Item 1</option> 
   <option value = "2">Item 2</option> 
</select> 

Read also : Example JSF h:selectOneMenu Dynamique values

Laisser un commentaire