如何避免WSOD(黑屏),而在Struts2的加载长时间运行初始化数据? [英] How to avoid WSOD (blank screen) while loading long-running initialization data in Struts2?

查看:143
本文介绍了如何避免WSOD(黑屏),而在Struts2的加载长时间运行初始化数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要做到以下几点:


  1. 用户登录。

  2. 重定向到欢迎屏幕。

  3. 在欢迎屏幕上,而大量记录被加载看起来。

  4. 重定向到工作画面。

我要寻找一种方式,Action类是这样做的:

I am looking for a way to do in Action class something like this:

public class LinkAction extends ActionSupport implements SessionAware {
        @Autowired
        private ServiceDelegate myService;

    public String welcome()
        {
            new Runnable() {
                @Override
                public void run() {
                    myService.getLoadsOfData();

                    //redirect to the next action

                }
            }.run();
            // this is where the user 
            // goes to look at the welcome screen        
            return "welcome";
        }
    }

可能这是一个错误的做法,请告诉我们,如果是这样,我在Struts的是新。

May be it's a wrong approach, please tell if so, I am new at Struts.

推荐答案

感谢您对AJAX的主意。

Thank you for the AJAX idea.

不过,我一直在寻找的答案,其实是Struts的拦截器execAndWait。
我决定,因为我处理现有应用程序和所有Struts的水管是在地方使用它了AJAX。
这是的Struts这个指南

However, the answer I was looking for was in fact Struts interceptor "execAndWait". I decided to use it over AJAX because I am dealing with existing application and all the Struts plumbing is in place. This is the Struts guide on this

这篇关于如何避免WSOD(黑屏),而在Struts2的加载长时间运行初始化数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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