How to avoid WSOD (blank screen) while loading long-running initialization data in Struts2?(在 Struts2 中加载长时间运行的初始化数据时如何避免 WSOD(空白屏幕)?)
问题描述
我需要做以下事情:
- 用户登录.
- 重定向到欢迎屏幕.
- 在加载大量记录时查看欢迎屏幕.
- 重定向到工作屏幕.
我正在寻找一种在 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(空白屏幕)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 Struts2 中加载长时间运行的初始化数据时如何避免 WSOD(空白屏幕)?
基础教程推荐
- 大摇大摆的枚举 2022-01-01
- Java Swing计时器未清除 2022-01-01
- 不推荐使用 Api 注释的描述 2022-01-01
- 在 Java 中创建日期的正确方法是什么? 2022-01-01
- 如何在 Spring @Value 注解中正确指定默认值? 2022-01-01
- 如何在 JFrame 中覆盖 windowsClosing 事件 2022-01-01
- 从 python 访问 JVM 2022-01-01
- 验证是否调用了所有 getter 方法 2022-01-01
- Java 实例变量在两个语句中声明和初始化 2022-01-01
- 多个组件的复杂布局 2022-01-01
