Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

jsf  RSS feed

 
Sukruti Patel
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to remember values from multiple h:selectOneMenu component in c:forEach loop. Now only last value from h:selectOneMenu is remember. I don't know how many h:selectOneMenu will appear.

 
Tim Holloway
Bartender
Posts: 18713
71
Android Eclipse IDE Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"JSF" was not a good title for this question. Every question in this forum is about JSF. If you want help about your specific problem, it's a good idea to let people know what the problem is in the title, because they may never bother to read the contents.

JSTL and JSF do not work well together, despite some questionable examples published by Oracle. If you want to repeat a control multiple times, you should use a JSF native repeating construct such as a dataTable or a ui:repeat.

Your fundamental problem is that since you're simply repeating the same stuff over and over, even if JSTL functions properly with JSF, JSF cannot tell which value goes with which copy of the control. They're all going to be dumped into collintattributevalueid.

You did the selectItem generation the hard way as well. A SelectItem is simply a value/label pair. If you construct a list or array of SelectItem where the label and (integer) value are the 2 elements, you don't need an explicit converter.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!