JSF 2 multiple select listbox example

In JSF, <h:selectManyListbox /> tag is used to render a multiple select listbox – HTML select element with “multiple” and “size” attribute. //JSF… <h:selectManyListbox value="#{user.favFood1}"> <f:selectItem itemValue="Fry Checken" itemLabel="Food1 – Fry Checken" /> <f:selectItem itemValue="Tomyam Soup" itemLabel="Food1 – Tomyam Soup" /> <f:selectItem itemValue="Mixed Rice" itemLabel="Food1 – Mixed Rice" /> </h:selectManyListbox> //HTML output… <select name="j_idt6:j_idt8" multiple="multiple" …

Read more

JSF 2 listbox example

In JSF, <h:selectOneListbox /> tag is used to render a single select listbox – HTML select element with “size” attribute. //JSF… <h:selectOneListbox value="#{user.favYear1}"> <f:selectItem itemValue="2000" itemLabel="Year1 – 2000" /> <f:selectItem itemValue="2010" itemLabel="Year1 – 2010" /> <f:selectItem itemValue="2020" itemLabel="Year1 – 2020" /> </h:selectOneListbox> //HTML output… <select name="j_idt6:j_idt8" size="3"> <option value="2000">Year1 – 2000</option> <option value="2010">Year1 – 2010</option> …

Read more