Hamza Toussi
Hamza Toussi

Reputation: 108

JSF selectOneMenu value renders unexpected output

i'm working with jsf component selectOneMenu but i get this random value 8e6a2a06-91dd-84a9-88b8-c2403de5d17d when inspecting html output

JSF :

 <h:selectOneMenu id="idSelect" 
                            value="#{bean.SelectValue}">
                            <f:selectItems value="#{bean.list()}" var="prts"
                            itemLabel="#{prts.libelle}" itemValue="#{prts.code}" />

                        </h:selectOneMenu>  

Upvotes: 2

Views: 50

Answers (1)

BalusC
BalusC

Reputation: 1108642

That will happen when there's an implicit or explicit Converter associated with the type behind itemValue. An example of an implicit converter is @FacesConverter(forClass=String.class). It would run on any model value of type String.class. An explicit converter is one which you specify via converter attribute of the input component, but this isn't visible in your code snippet posted so far (unless you oversimplified the snippet without actually testing it).

At least, the generated value is recognizable as outcome of UUID.randomUUID().toString(), so if you search for that line of code in your code base, you will find the suspected converter. Perhaps it's kind of "generic entity converter" which you can find at several places on the Internet, but which you'd after all actually better not use.

Upvotes: 1

Related Questions