Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Struts Wiki" for change 
notification.

The following page has been changed by BaqHaidri:
http://wiki.apache.org/struts/StrutsPleaseWait

------------------------------------------------------------------------------
  === A plug & play solution to add a 'Please Wait' page to any Struts action 
===
  
- A while back I was tasked with providing 'please wait' functionality to the 
[http://panther.appliedbiosystems.com PANTHER] website. The requirements were 
that the solution be easily added to any action that the programmer felt needed 
it.  Conversely, it should be just as easily removable, if the background 
action were in some way sped up or changed.  We already decided that using 
Javascript/CSS/hiding layers/etc. was not the right solution for us.  I thought 
to myself, given Struts' remarkable page flow flexibility and general 
extensibility, there's got to be a way to do this elegantly.  I couldn't really 
find anything on the web that showed a satisfactory solution.   When I finally 
came up with a solution, I was surprised that the Struts package didn't already 
come with a feature like it.  I wondered to myself if there was something deep 
down terribly wrong with my method because I couldn't find anything similar 
published on the web.  I still wonder that but as of yet, I h
 aven't found any problems with it and the solution was pushed to production.  
It's up to all of you in the user community to provide feedback and 
improvements. 
+ A while back I was tasked with providing 'please wait' functionality to the 
[http://panther.appliedbiosystems.com PANTHER] website. The requirements were 
that the solution be easily added to any action that the programmer felt needed 
it.  Conversely, it should be just as easily removable, if the background 
action were in some way sped up or changed.  We already decided that using 
Javascript/CSS/hiding layers/etc. was not the right solution for us.  I thought 
to myself, given Struts' page flow flexibility and general extensibility, 
there's got to be a way to do this elegantly.  I couldn't really find anything 
on the web that showed a satisfactory solution.   When I finally came up with a 
solution, I was surprised that the Struts package didn't already come with a 
feature like it.  
  
  The entire solution itself involves five elements:
  
@@ -37, +37 @@

   1. {{{RequestProcessor's}}} {{{processActionPerform}}} receives a request.
   2. It checks the action mapping to see if it's a long transaction.  If not, 
call {{{super.processActionPerform}}} and it's business as usual. 
   3. The {{{ActionMapping}}} specifies a long transaction.  Check a session 
attribute to make sure this isn't the SECOND time we've received this same 
request (this will make more sense later).  It isn't.
-  4. We create a {{{ForwardActionBean}}} class.  If this is a GET request, we 
store away the entire request string, form parameters and all, into this bean.  
We store the bean in the user's session.  If it is a POST request, we store 
away the request in the bean and we store the bean away into the user's 
session.  We ALSO clone the current form (already validated) and store that 
away into the user's session as well.
+  4. We create a {{{ForwardActionBean}}} object.  If this is a GET request, we 
store away the entire request string, form parameters and all, into this bean.  
We store the bean in the user's session.  If it is a POST request, we store 
away the request in the bean and we store the bean away into the user's 
session.  We ALSO clone the current form (already validated) and store that 
away into the user's session as well.
   5. After doing this bookkeeping, we forward off the please wait jsp page.
   6. The please wait jsp contains a META tag which basically ''re-requests the 
same request'' that is specified by the {{{ForwardActionBean}}} which is stored 
away in the user's session.  The client browser now basically "hangs" on this 
please wait page.
   7. {{{RequestProcessor's}}} {{{processActionPerform}}} receives a request 
for a long transaction.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to