You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Dhruva B. Reddy" <sl...@yahoo.com> on 2003/07/15 21:23:04 UTC

Splash Screen in Struts

I have an Action that could potentially take a long time to execute,
and would like to display a splash screen until the results of the
action are ready.

I went googling for this, but I can't seem to find a solution that
would fit within the Struts framework.  Has anyone done this before?

Thanks,
Dhruva

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Splash Screen in Struts

Posted by Yann C�bron <ya...@yahoo.de>.
> I have an Action that could potentially take a long time to execute,
> and would like to display a splash screen until the results of the
> action are ready.
>
> I went googling for this, but I can't seem to find a solution that
> would fit within the Struts framework.  Has anyone done this before?
>

Found this article: "JSP Progress Bars"

http://www.onjava.com/pub/a/onjava/2003/06/11/jsp_progressbars.html


This might be interesting, too (but maybe too much for your needs):

http://www.javaworld.com/javaworld/jw-03-2000/jw-03-pushlet.html?

There's also some tricks with JavaScript and/or HTML-META-REFRESH tags,
search the user-list..


HTH,
    Yann




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Splash Screen in Struts

Posted by Aaron Longwell <li...@newmedialogic.com>.
I'll have to look into this... I know I did it before in a situation 
with frames.... Javascript was actually executed in some other frame... 
so that the long-loading window could be manipulated by another frame 
(which can always execute javascript even when the other window is loading).



Dhruva B. Reddy wrote:

>This doesn't seem to work--nothing after the first submit() call gets
>executed.
>
>I assume you put all of this code in the onclick handler for the submit
>button.
>
>--- Aaron Longwell <li...@newmedialogic.com> wrote:
>  
>
>>Dhruva,
>>
>>I have done this before.... the absolute cleanest implementation is 
>>almost 100% javascript:
>>
>>1) Javascript submit(); call to start POST page loading
>>2) Javascript delete contents of the window
>>(javascript:document.clear();)
>>3) Write new content to the window... adding in an <img> tag to a 
>>animated GIF (or, cooler a Flash movie)
>>this is done with one call to document.write(str); You have to
>>populate 
>>the str variable first because each document.write causes the window
>>to 
>>be cleared and then rewritten.
>>
>>Item #2 is somewhat optional, but I like it for clarity and I'm a
>>little 
>>weird.
>>
>>Aaron
>>
>>Dhruva B. Reddy wrote:
>>
>>    
>>
>>>I have an Action that could potentially take a long time to execute,
>>>and would like to display a splash screen until the results of the
>>>action are ready.
>>>
>>>I went googling for this, but I can't seem to find a solution that
>>>would fit within the Struts framework.  Has anyone done this before?
>>>
>>>Thanks,
>>>Dhruva
>>>
>>>__________________________________
>>>Do you Yahoo!?
>>>SBC Yahoo! DSL - Now only $29.95 per month!
>>>http://sbc.yahoo.com
>>>
>>>      
>>>
>>---------------------------------------------------------------------
>>    
>>
>>>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>>
>>>
>>>
>>>
>>> 
>>>
>>>      
>>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>
>>    
>>
>
>
>__________________________________
>Do you Yahoo!?
>SBC Yahoo! DSL - Now only $29.95 per month!
>http://sbc.yahoo.com
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Splash Screen in Struts

Posted by "Dhruva B. Reddy" <sl...@yahoo.com>.
This doesn't seem to work--nothing after the first submit() call gets
executed.

I assume you put all of this code in the onclick handler for the submit
button.

--- Aaron Longwell <li...@newmedialogic.com> wrote:
> Dhruva,
> 
> I have done this before.... the absolute cleanest implementation is 
> almost 100% javascript:
> 
> 1) Javascript submit(); call to start POST page loading
> 2) Javascript delete contents of the window
> (javascript:document.clear();)
> 3) Write new content to the window... adding in an <img> tag to a 
> animated GIF (or, cooler a Flash movie)
> this is done with one call to document.write(str); You have to
> populate 
> the str variable first because each document.write causes the window
> to 
> be cleared and then rewritten.
> 
> Item #2 is somewhat optional, but I like it for clarity and I'm a
> little 
> weird.
> 
> Aaron
> 
> Dhruva B. Reddy wrote:
> 
> >I have an Action that could potentially take a long time to execute,
> >and would like to display a splash screen until the results of the
> >action are ready.
> >
> >I went googling for this, but I can't seem to find a solution that
> >would fit within the Struts framework.  Has anyone done this before?
> >
> >Thanks,
> >Dhruva
> >
> >__________________________________
> >Do you Yahoo!?
> >SBC Yahoo! DSL - Now only $29.95 per month!
> >http://sbc.yahoo.com
> >
>
>---------------------------------------------------------------------
> >To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
> >
> >
> >
> >  
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Splash Screen in Struts

Posted by Aaron Longwell <li...@newmedialogic.com>.
Dhruva,

I have done this before.... the absolute cleanest implementation is 
almost 100% javascript:

1) Javascript submit(); call to start POST page loading
2) Javascript delete contents of the window (javascript:document.clear();)
3) Write new content to the window... adding in an <img> tag to a 
animated GIF (or, cooler a Flash movie)
this is done with one call to document.write(str); You have to populate 
the str variable first because each document.write causes the window to 
be cleared and then rewritten.

Item #2 is somewhat optional, but I like it for clarity and I'm a little 
weird.

Aaron

Dhruva B. Reddy wrote:

>I have an Action that could potentially take a long time to execute,
>and would like to display a splash screen until the results of the
>action are ready.
>
>I went googling for this, but I can't seem to find a solution that
>would fit within the Struts framework.  Has anyone done this before?
>
>Thanks,
>Dhruva
>
>__________________________________
>Do you Yahoo!?
>SBC Yahoo! DSL - Now only $29.95 per month!
>http://sbc.yahoo.com
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Splash Screen in Struts

Posted by "Dhruva B. Reddy" <sl...@yahoo.com>.
OK, for those of you following this thread, I ended up getting this to
work, although it's kind of ugly IMHO.

In splashAction, I cram the form containing the data from input.jsp
into the request, then forward to splash.jsp, which keeps the data in
hidden fields (populated by the previous form).  The "onload" event
handler in the "body" tag of splash.jsp automatically submits the form
to longAction.do (the action that needed the data in the first place).

There is a bit of lag time (0.5 to 1 second) in displaying the splash
screen, but the browser (I've tried this with Mozilla and IE) then
displays the splash screen until the results are ready.

Thanks to those who responded to my original post.  I wanted to try
subclassing the ActionServlet as suggested, but I needed to get this
and several other things done by the end of the week.

Dhruva

--- "Dhruva B. Reddy" <sl...@yahoo.com> wrote:
> OK, let me ask this:
> 
> Let's say that I have input.jsp, which goes to longAction.do, which
> in
> turn forwards to long_results.jsp when finished.  I've noticed that
> the
> contents of input.jsp remain displayed after the submit button is
> clicked, until the contents of input.jsp are ready for the browser to
> load.
> 
> I have tried to take advantage of this by creating an intermediate
> action, splashAction.do, which forwards to splash.jsp, which in turn
> forwards to longAction.do (I have a jsp:forward tag at the end of
> splash.jsp).  splashAction.do is invoked by the submit button on
> input.jsp.  I would expect the contents of splash.jsp to be displayed
> until the contents of long_results.jsp are ready for display. Yet the
> contents of input.jsp remain displayed until long_results.jsp is
> ready,
> just as before--I never see splash.jsp.
> 
> Can anyone tell me why this didn't work?
> 
> Thanks,
> Dhruva
> 
> --- "Dhruva B. Reddy" <sl...@yahoo.com> wrote:
> > I have an Action that could potentially take a long time to
> execute,
> > and would like to display a splash screen until the results of the
> > action are ready.
> > 
> > I went googling for this, but I can't seem to find a solution that
> > would fit within the Struts framework.  Has anyone done this
> before?
> > 
> > Thanks,
> > Dhruva
> > 
> > __________________________________
> > Do you Yahoo!?
> > SBC Yahoo! DSL - Now only $29.95 per month!
> > http://sbc.yahoo.com
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> > 
> 
> 
> __________________________________
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Splash Screen in Struts

Posted by "Dhruva B. Reddy" <sl...@yahoo.com>.
OK, let me ask this:

Let's say that I have input.jsp, which goes to longAction.do, which in
turn forwards to long_results.jsp when finished.  I've noticed that the
contents of input.jsp remain displayed after the submit button is
clicked, until the contents of input.jsp are ready for the browser to
load.

I have tried to take advantage of this by creating an intermediate
action, splashAction.do, which forwards to splash.jsp, which in turn
forwards to longAction.do (I have a jsp:forward tag at the end of
splash.jsp).  splashAction.do is invoked by the submit button on
input.jsp.  I would expect the contents of splash.jsp to be displayed
until the contents of long_results.jsp are ready for display. Yet the
contents of input.jsp remain displayed until long_results.jsp is ready,
just as before--I never see splash.jsp.

Can anyone tell me why this didn't work?

Thanks,
Dhruva

--- "Dhruva B. Reddy" <sl...@yahoo.com> wrote:
> I have an Action that could potentially take a long time to execute,
> and would like to display a splash screen until the results of the
> action are ready.
> 
> I went googling for this, but I can't seem to find a solution that
> would fit within the Struts framework.  Has anyone done this before?
> 
> Thanks,
> Dhruva
> 
> __________________________________
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org