-1

I'm creating a dropdown in jsf with all different defects. There are some duplicates in it. How can I create a h:selectOneMenu with only unique values?

This is my code so far:

<h:selectOneMenu value=#{repairBean.defect}">
    <f:selectItems value="#{repairBean.defects}"/>
</h:selectOneMenu>

repairBean:

@PostConstruct
public void initRepair(){
    setDefects(repairService.getAllDefects();
}
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Warri
  • 217
  • 1
  • 3
  • 14
  • 2
    Are you saying the backing list doesn't have duplicates, that the selectOneMenu is introducing the dupes? – kolossus Aug 06 '14 at 05:17
  • 1
    Why should it be the responsibility of the view? You just supplied the wrong model to it and you're supposed to fix it in the model side. – BalusC Aug 06 '14 at 06:11

1 Answers1

0

first check your list in backing bean , i think it's caused by your method getAllDefects() that returned duplicated values ( try to display the value of this returned list )

Abdelghani Roussi
  • 2,707
  • 2
  • 21
  • 39