javahttp-redirectasynchronousstruts2wsod

How to avoid WSOD (blank screen) while loading long-running initialization data in Struts2?


I need to do the following:

  1. User logs in.
  2. Redirected to welcome screen.
  3. Looks at the welcome screen while lots of records are loaded.
  4. Redirected to the working screen.

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";
        }
    }

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


Solution

  • Thank you for the AJAX idea.

    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