This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSF and the fly likes HtmlSelectOneMenu Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "HtmlSelectOneMenu" Watch "HtmlSelectOneMenu" New topic


Pinal N Patel
Ranch Hand

Joined: Sep 05, 2003
Posts: 57
Greetings everyone,

I can't get HtmlSelectOneMenu to return the selected value. Please let me know how to correct this problem. Please refer to the code below for review. Basically, I have a drop down menu and a command button. User selects from the drop down menu and clicks on the command button for the action to execute for the selected value from the drop down menu.

System.out.println on the setter method always returns NULL though something was selected from the drop down menu.

Any help is appreciated. Thanks in advance!!

Pinal N Patel
Ranch Hand

Joined: Sep 05, 2003
Posts: 57
ok, so it works now.

I used method getSubmittedValue() on HtmlSelectOneMenu instead of getValue() to get the selected item from the drop down menu. It turns out, getValue() is used for UIOutput and getSubmittedValue() is used for UIInput.
I agree. Here's the link:
subject: HtmlSelectOneMenu
Similar Threads
My valueChangeListener is never being called...
JSF does not call action in managed bean
JSF backingbean value is null always.
<h:commandButton not invoking its action method after enabling
Value change listener updating bean