"processing status" and Struts design
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   erl_grey
Posted On:   Monday, August 26, 2002 08:34 AM

Hi guys, I'm trying to do the following: When a request comes in, do some processing in the server, give back to the user some written indications on the progress, and when finished display the result- all without using http-refresh in the client side. i'm trying very hard not to put any business logic in the jsp, just keep it for display, but it doesn't seem easy with this issue. my current idea of implementation is to receive the request, forward to a jsp, which will contain tags for other resources and will display the progress. yet this implementation has some of the processing logic (and flow) encapsulated in the jsp, and it screams "troubles in the future". if i were using   More>>

Hi guys,

I'm trying to do the following:

When a request comes in, do some processing in the server, give back to the user some written indications on the progress, and when finished display the result- all without using http-refresh in the client side.



i'm trying very hard not to put any business logic in the jsp, just keep it for display, but it doesn't seem easy with this issue.

my current idea of implementation is to receive the request, forward to a jsp, which will contain tags for other resources and will display the progress. yet this implementation has some of the processing logic (and flow) encapsulated in the jsp, and it screams "troubles in the future".

if i were using straight servlets, i would have probably done it using simple RequestDispatcher.include() calls to status jsp's. anyone has a good design tip ?

Thanks!

   <<Less

Re: "processing status" and Struts design

Posted By:   Geir_Arnesen  
Posted On:   Tuesday, August 27, 2002 11:22 AM


I had the same problem and I solved it by, in the action class when I had this "time consuming"
action where I wanted to display a "please wait"-page

....
if(action.equals(messages.getMessage("button.justify"))){
//Passing the action maping to request from the wait-form
request.getSession().setAttribute("REDIRECT_ACTION_FORM",request.getContextPath()+mapping.findForward("/adk/justify").getPath());
return (mapping.findForward("wait"));
}

I put the "real-mapping" into a session attribute, - and request a "wait" action which is as follows:


">
">


Please wait....


This page displays a message, - and requests the "real"-action

In the action:
"/adk/justify"

the REDIRECT_ACTION_FORM attribute is removed again...

This works fine....

Geir

Re: "processing status" and Struts design

Posted By:   Joachim_Schaaf  
Posted On:   Monday, August 26, 2002 09:38 AM

Hi. I had a similar problem: I wanted to display a "please wait" page for every Struts action.



So I have written a servlet, that is mapped to the *.do URL pattern, and the Struts Action servlet itself is mapped to *.dox.

Whenever the user clicks on a *.do-link, my servlet is executed, which replaces the "do" with a "dox" in the query string, puts it in the Http session and redirects to the wait JSP page. The JSP page gets the string from the session and uses Javascript (body onload="...") to load/execute the action.


There are some drawbacks of this solution: POST doesn't work, and the generated FORM tags in JSP pages have a dox suffix, so my servlet isn't executed.


Hope this helps,

Joachim

About | Sitemap | Contact