You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by James Childers <jc...@hotels.com> on 2003/07/15 22:02:14 UTC
RE: Splash Screen in Struts ("Please Wait" page) (Cont'd, sorry)
> -----Original Message-----
> From: James Childers
> Sent: Tuesday, July 15, 2003 2:59 PM
> To: Struts Users Mailing List
> Subject: RE: Splash Screen in Struts ("Please Wait" page)
>
>
> Yes.
>
> "But beware O Man, beware, of Those who tread in Darkness the
> ramparts of Kadath, for he that beholds Their mitred-heads
> shall know the claws of doom."
>
> I've actually been struggling with this for a while now, and
> have come up with a solution that (mostly) works, but it has
> been difficult.
>
> Our requirements were:
>
> 1) Display a happy little animation for the user's benefit
> 2) Have browser's "throbber" throb while the "wait" page is displayed
> 3) Work within the Struts framework
> 4) Being a good netizen, you want this to work on different browsers
>
> The best solution I have found is to extend ActionServlet and
> ActionMapping in order to add a "please wait" flag to both
> via struts-config. Your WaitActionMapping would simply have
>
> private boolean showWaitPage = false;
>
> with the appropriate getter and setters in it. You would then
> set this parameter via struts-config and be done with that part of it.
>
> In WaitActionServlet you would check the showWaitPage value
> for that mapping, and if true you would at this point show
> the splash screen using (!) out.prints. After this you would
> do an out.flush(), which would show the splash screen to the
> user but leave the connection open.
>
> Now you do your heavy-duty task, probably in a separate
> thread, and check it occasionally from within
> WaitActionServlet. If it's done, you send some JavaScript to
> overwrite the splash screen and forward to the appropriate
> JSP as defined in your struts-config.
>
> Now, this is all completely theoretical, because our rather
> expensive servlet container has an extremely irritating bug
> that causes out.flush() to not work. The solution we
> implemented involves
subclassing Action and adding a parameter to the session that indicates if the task is done or not. The JSP has a meta-refresh tag in the <head> section that submits to the Action every couple of seconds; the Action checks to see if the task is done. If so, it forwards to the "success" JSP. If not, it forwards to the "wait" page again.
-= J
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org