JSF2,从 ViewScoped bean 重新加载页面而不破坏该 bean?
我有一个小问题想解决。 我将 Apache Myface 2 与 Tomahawk 和 Trinidad 结合使用。 特立尼达提供其对话框框架来创建模态对话框... 我的问题是,对话框关闭后,我想刷新(重新渲染)调用者页面。 作为一种解决方案,我处理 ReturnListener,更新 bean 的数据,并发送一个ExternalContext.redirect 来重新加载我的页面...但是我的 ViewScoped bean 被销毁并创建了一个新的 bean! 这是非常合乎逻辑的,但是有没有办法从 Viewscoped bean 重新加载页面而不发送重定向(这会破坏 bean...)? 是使用部分重新渲染的唯一解决方案吗?
为了让它工作,我将范围更改为会话,但在我的情况下它很丑陋。
感谢您的回答。
I've got a little problem I'd like to solve.
I use Apache Myface 2 with Tomahawk and Trinidad.
Trinidad delivers its Dialog Framework to create Modal Dialogs...
My problem is that after the Dialog is closed, I want to refresh (re-render) the caller page.
As a solution I handle the ReturnListener, update the data of my bean, and send an ExternalContext.redirect to reload my page... but my ViewScoped bean is destroyed and a new one is create !
It is quite logical, but is there a way to reload a page from a Viewscoped bean without sending a redirect (that will destroy the bean...) ?
Is the only solution to use partial redering ?
To have it work I changed the scope to Session, but it's uggly in my case.
Thanks for your answers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想坚持查看范围,那么只有 ppr 可以提供帮助,实际上在顶级元素上设置partialTrigger并不难,这将刷新内部的所有内容。
另一方面,如果您可以使用会话或应用程序范围,我认为您已经能够做到这一点。
If you want to stick to view scope then yes only ppr can be of help, its not actually hard to set partialTrigger on the top level element which will refresh everything inside.
On the other had if you are ok to go with session or application scope i think you already are able to do that.