恢复视图后刷新数据
是否有类似 @PostConstruct
的注释用于恢复视图后应调用的方法?我想每个请求刷新一次数据。有什么想法如何做到这一点?
Is there an annotaion like @PostConstruct
for methods which should be called after restoring the view? I want to refresh data once per request. Any ideas how to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不是注释,但您可以为此使用
。然而
,我想知道该 bean 是否不能更好地放置在请求范围中,因为它似乎也包含请求范围的数据。也许您需要将 bean 分成不同作用域中的两个 bean,其中一个是请求作用域,它保存每个请求时需要刷新的数据。
Not an annotation, but you can use
<f:event type="preRenderView">
for this.with
I however wonder if that bean can't better be placed in the request scope as it seems to hold request scoped data as well. Perhaps you need to split the bean into two beans in different scopes, one of them being request scope which holds the data you need to refresh on every request.