Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

2 - Questions regarding <h:selectOneListbox...>  RSS feed

 
Melinda Savoy
Ranch Hand
Posts: 387
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my JSF page I have the following dropdown box that is getting populated from a database:



I think I made my initial question a lot more difficult than necessary as I got into the weeds, my apologies.

1st question: How can I find out what option was selected in the dropdown above?
2nd question: How can I define the default value in the dropdown above?

Thank you.
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. JSF will set the property that you specified in the value= attribute of the selectOneListbox element when the form is submitted to the selected value.

2. There's no such thing as a "default", but you preselect by initializing the property that you specified in the value= attribute of the selectOneListbox element to the "default" value.
 
Melinda Savoy
Ranch Hand
Posts: 387
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim - thanks for taking the time to reply. I finally got it fixed.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!