I have the following problem - I have a SelectOneMenu, first item is just an information to ask the user to select item from the drop item menu and after that are the real values. I have a Converter which work properly when i select and element from the drop down, but when the user does not select anything i jot this error {0}: Conversion error occurred.
Here is the logic for selectOneMenu:
<h:selectOneMenu value="#{requestBean.selectedEventType}"
converter="tEventTypeConverter"
required="true" requiredMessage="Please, select item!">
<f:selectItem itemLabel="Избери тип" itemvalue="#{null}"/>
<f:selectItems value="#{eventTypeBean.selectItems}" var="eventType"
itemLabel="#{eventType.eventTypeName}" itemValue="#{eventType}" />
</h:selectOneMenu>
This is the part from the Converter class, where it fails:
public String getAsString(FacesContext context, UIComponent component,
Object value) {
if (value == null) {
return null;
}
...
It event did not show me the message "Please, select item!", when no element is selected. It treats the first one, as NULL and i don't know how to get rid of it. I appreciate any help.