2

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>  
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Hamza Toussi
  • 108
  • 10
  • @BalusC thank you for your answer, i just viewed the source in my browser and it generated the random value so the javascript it's right but how i can get the real value ?? – Hamza Toussi Mar 25 '16 at 14:44
  • 1
    JSF is just presenting whatever your `#{prts.code}` contains. It doesn't manipulate it or so, unless there's an implicit converter which you didn't tell anything about. So, you need to take a step back before JSF and check your model and any implicit converters associated with the model type represented by `#{part.code}`. – BalusC Mar 25 '16 at 14:45
  • @BalusC thank you so much for your help, i had a converter that i told anything about so when i removed that converter everything work fine now – Hamza Toussi Mar 25 '16 at 14:52

1 Answers1

1

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.

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555