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

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

问题描述

我需要做以下事情:

  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".我决定在 AJAX 上使用它,因为我正在处理现有的应用程序并且所有的 Struts 管道都已就位.这是 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

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

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