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

setting initial values for SelectOneMenus inside of an HtmlDataTable  RSS feed

Jason Nesbitt
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an HtmlDataTable where one of the columns contains a SelectOneMenu. This SelectOneMenu represents the months in a year. What I want to do is set the initial value to last month when the table is first viewed and I'm not sure how to do this. My first thought was to bind the value attribute to a backing bean property but that doesn't work because you end up with many SelectOneMenus that are bound to the same backing bean property. My guess is that I need to somehow hook into the lifecycle of the HtmlDataTable and set this initial value upon creation of the SelectOneMenu but I don't know. Can someone kindly point me in the right direction?
Also, when the submit button in each row is clicked I get the value of the SelectOneMenu like this:

Is that the best way to find the value of the SelectOneMenu? It works but I don't like it because the code is dependent upon how the component tree inside of the column is layed out. If I later decide to put my submit button inside of an HtmlPanelGrid then this won't work.


It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!