Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSF2: Problem (ClassCastException) with Collection and <h:selectOneListbox>  RSS feed

 
Kai Wähner
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I do not understand how to use the listbox tag in JSF.

Java Getter and Setter for the list:


I tried several things, but the Listbox does not show my collection entries:



Can someone please tell me how to solve this problem? I used Google, but did not find a proper example.

Thank you.


Best regards, Kai
 
Nick Potter
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are you trying to achieve, exactly?
 
Kai Wähner
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you.

This works. But now, I cannot use:

<f:selectItems value="#{indexBean.kundenliste.get(i).name}"/>

???
 
Nick Potter
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need a list of SelectItems that contains the names.
 
Kai Wähner
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see, thank you.

So, I know how to solve the problem - although I hoped there was an easier way in JSF 2.0...
 
Nick Potter
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe someone else knows about it, I don't sorry. Although I know seam support this without the need for a selectItems list.
 
Kai Wähner
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nevertheless, now I can solve the problem... Maybe there is no better solution.

I just realized a little project with Grails, this is why I am used to deleoping easy and efficient web applications at the moment :-)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!