Primefaces:Ajax状态在重定向到新页面时停止 [英] Primefaces: Ajax status stops on redirection to new page

查看:113
本文介绍了Primefaces:Ajax状态在重定向到新页面时停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 page1.jsf page2.jsf . Page1的<p:ajaxstatus/>中带有自定义微调框. 在页面1上执行操作并将用户重定向到页面2时,微调器立即启动和停止,但page1保持原样,几秒钟后加载并渲染了page2.

I have page1.jsf and page2.jsf. Page1 has <p:ajaxstatus/> with custom spinner in it . When an action is performed on page 1 and the user is redirected to page 2, the spinner starts and stops immediately but page1 remains as it is and after few seconds page2 is loaded and is rendered.

如何使微调框旋转,直到完全渲染page2.

How can I keep the spinner spinning until page2 is fully rendered.

推荐答案

我假设您正在为页面1使用@ViewScoped bean.

I assume you are using a @ViewScoped bean for page1.

当您重定向到page2时,视图将创建到page2,并且已取消引用/销毁了page1的视图作用域bean.因此,对该bean的Ajax请求将被忽略.

When you redirect to page2, the view is created to page2, and the view scoped bean for page1 is dereferenced/destroyed. Ajax request to that bean are thus ignored.

我知道的唯一解决方案是将page1的bean设置为@SessionScoped,但这可能会影响应用程序的行为.

The only solution that I know of would be setting the bean for page1 as @SessionScoped, but that may affect the behavior of your application.

这篇关于Primefaces:Ajax状态在重定向到新页面时停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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