如何在 JSF 中切换支持 bean 对象?
假设我有几个标签、文本输入、无线电等引用一个实例对象。我想使用该页面上的下拉菜单将前面提到的引用切换到该对象的另一个实例。
通过更改监听器,这部分非常容易。然而,我遇到的问题是当前显示在屏幕上的值被设置到新的第二个实例中。
我希望将当前值存储在当前实例中,然后当页面刷新时,我希望新值来自新实例并显示在屏幕上。
有办法做到这一点吗?我的问题有意义吗?
格雷
Suppose I several tags, text input, radios, etc referencing one instance object. I would like to use a dropdown on that page to switch the references mentioned before to another instance of the object.
This part is pretty easy with change listener. However, the problem I have is the values currently displayed on the screen are getting set into the new, second instance.
I would like the current values to be stored in the current instance, and then the when the page refreshes I would like the new values to come from the new instance and be displayed on the screen.
Is there was way to do this? Does my question make any sense?
Grae
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
值更改侦听器完全是错误的工具,因为它在设置值之前被调用。
您想要的是一个操作侦听器,它将在验证和设置页面中的值后调用。
A value change listener is exactly the wrong tool for this, because it gets called before the values are set.
What you want is an action listener, which will get call after the values from the page are validated and set.