JSF Showcase
f:selectItem
This component can be used as a children element of any UISelectOne or UISelectOne to declare the possible options of the element value.General Usage
In f:selectItem, useitemLabel
for the text that will be visible to users, and itemValue
for the value that will be set if that option was chosen. itemDescription
is used as documentation purposes (for development tools). noSelectionOption
is used for some failed validations. Use value
to use a programmatic UISelectItem through an evaluated EL expression.
Source Code
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://xmlns.jcp.org/jsf/core" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:ui="http://xmlns.jcp.org/jsf/facelets"> <h:form> <h:selectOneMenu value="#{inputTextModelBean.text}"> <f:selectItem itemLabel="#{i18n['item-1-label']}" itemValue="#{i18n['item-1-value']}"/> <f:selectItem itemLabel="#{i18n['item-2-label']}" itemValue="#{i18n['item-2-value']}"/> <f:selectItem itemLabel="#{i18n['item-3-label']}" itemValue="#{i18n['item-3-value']}"/> </h:selectOneMenu> <h:commandButton value="#{i18n['submit']}"> <f:ajax execute="@form" render="@form"/> </h:commandButton> <h:outputText value="#{inputTextModelBean.text}"/> </h:form> </ui:composition>
@ManagedBean @RequestScoped public class InputTextModelBean { private Date date = new GregorianCalendar().getTime(); private String text; public Date getDate() { return date; } public String getText() { return text; } public void setDate(Date date) { this.date = date; } public void setText(String text) { this.text = text; } }
Liferay Faces Bridge Implementation 5.0.0 + Showcase Common 3.1.1 + Liferay Faces Util 3.4.1 + Mojarra 2.2.20