在 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
相关文章