获取 selectOneMenu 选定值
我有一个 selectOneMenu 的 clientId。我以编程方式调用 UIComponent 使用。但这就是我感到困惑的地方,我想获取 selectOneMenu 上选定的值。我尝试过 getValue(),它给出默认值,而 getsubscribedvalue() 给出 null。
有人可以帮我吗?
提前致谢
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您在 JSF 生命周期的错误时刻调用它时,或者当该组件是像
h:dataTable
这样的迭代组件的一部分并且该组件当前 不在迭代阶段。毕竟,这不是 JSF 的工作方式。正常的方法是将值绑定到 bean 属性,然后在与命令链接/按钮关联的操作方法中准确访问该属性。无论如何,我认为我在 您的其他问题。
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.