1

i have a clientId for selectOneMenu. i programmatically invoke the UIComponent using. but this is where i get confused, i want to get the selected value on the selectOneMenu. i have tried getValue(), it gives the default value , and getsubmittedvalue() gives null.

can someone please help me?

thanks in advance

Ikthiander
  • 3,917
  • 8
  • 37
  • 54
  • Without some code it is hard to tell! – Matt Handy Mar 18 '11 at 07:24
  • @bluefoot i am not an ungrateful person trust me. if i did not accept any correct answer by mistake , please let me know and i will accept them. if the answer was not correct and i accept it, this would misguide the people who are falling in the same problem, right? – Ikthiander Mar 19 '11 at 02:04
  • right. but maybe you should improve them. or maybe not. anyway, I'm glad you have read the [faq](http://stackoverflow.com/faq) – bluefoot Mar 23 '11 at 19:20

1 Answers1

1

This discrepancy can occur when you're invoking it at the wrong moment of the JSF lifecycle or when the component is part of an iterated component like h:dataTable and the component is currently not in the iteration stage. After all, this isn't the way how the JSF stuffs ought to work. The normal approach is to bind the value to a bean property and then just access exactly that property in the action method associated with the command link/button.

Anyway, I think that the actual problem is already been solved by my answer on your other question.

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • thanks. i hope @bluefoot also notices, i accept right answers, otherwise people who fall into the same problem would be misguided. – Ikthiander Mar 21 '11 at 19:27
  • You're welcome. As to bluefoot, don't take it personally. If an answer didn't help in any way in solving your problem, just leave it unaccepted. You're however always eligible to post an answer on your own question for the case that you've already solved/answered it by yourself and then mark it accepted. Or when it's still unanswered, consider improving the question or putting a bounty on it. – BalusC Mar 21 '11 at 19:29