CDI/焊接-结束对话后如何处理浏览器页面刷新? [英] CDI/Weld - how to handle browser page refresh after ending conversation?

查看:113
本文介绍了CDI/焊接-结束对话后如何处理浏览器页面刷新?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用CDI的早期,我导航到运行时间较长的页面 对话使用faces-redirect = true处于活动状态,所以我有一个网址,例如..myPage.xhtml?cid = 1.

In the very early days of using CDI I'm navigating to a page with a long running conversation active using faces-redirect=true, so I have a URL like ..myPage.xhtml?cid=1.

在某个时候我结束对话,我的意思是这必须是一件合理的事情 还是您最好使用会话范围?无论如何,我结束了对话,然后 用户按下F5,然后当然会导致cid = 1,导致未找到对话"错误 不存在.

At some point I end the conversation, I mean this has to be a reasonable thing to do or you might as well use session scope? Anyway, I end the conversation and then the user hits F5, and then of course this causes a 'conversation not found' error as cid=1 doesn't exist.

有人可以建议如何解决这个问题吗?我正在使用史蒂芬·韦伯(Steven Verborgh) ViewScoped实现,只需使用对话范围的Bean来传递参数 页面之间.因此,例如,我有2个@ViewScoped Bean,每个Bean的后页1& 2. 我@将@ConversationScoped ParameterBean注入两个视图范围的Bean中.我开始 从中调用的动作方法中的对话(parameterBean.getConversation().begin()) 第1页.在第2页的preRenderView事件中,我引用了以下属性 将parameterBean放入第2页支持bean实例变量,并结束对话, 完成了它的工作,不再需要.

Can anyone suggest how to get around this problem? I'm using the Steven Verborgh ViewScoped implementation and simply using a conversation scoped bean to pass parameters between pages. So I have for example 2 @ViewScoped beans each of which back page 1 & 2. I @Inject the @ConversationScoped ParameterBean into both view scoped beans. I start the conversation (parameterBean.getConversation().begin()) in the action method called from page 1. In the preRenderView event for page 2 I take a reference to the properties of the parameterBean into a page 2 backing bean instance variable and end the conversation, it's done it's job and no longer required.

除F5问题外,它都能正常工作.如果有人有任何建议,我将不胜感激, 希望我不会错过真正明显的东西.我有点假设没有 远离重定向.

Except for the F5 problem it works fine. If anyone has any suggestions I'd appreciate it, hopefully I'm not missing something really obvious. I kind of assuming there's no getting away from a redirect.

谢谢.

推荐答案

没有解决方法.默认的@ConversationScoped被完全破坏了.我使用的是MyFaces CODI中的@ConversationScoped.它解决了标准示波器可能遇到的所有问题.

There is no workaround for it. The default @ConversationScoped is utterly broken. I'm using the @ConversationScoped from MyFaces CODI instead. It solves all problems you can get with the standard scope.

这篇关于CDI/焊接-结束对话后如何处理浏览器页面刷新?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆