struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chase <ch...@osdev.org>
Subject Re: ExecAndWait (navigating back to the progress page)
Date Fri, 18 Jul 2008 00:30:58 GMT
In my case it is a very long running action but even in the case of
short running actions I would think users would want to be able to
navigate away from the progress page and return. I thought maybe I
just didn't know how to configure the actions correctly....

EDIT: So while writing the above reply a solution occurred to me. With
a little trickery it's possible to do everything I was talking about
with no AJAX. Documenting this pattern below in case anyone else ever
comes across this problem.

Have a single Action that directs the users to the form view and also
handles the form submission. This solution will make it impossible for
a user to view the form again until their task is complete. The key is
to  always use a delay for the execAndWait interceptor.

<interceptor-ref name="execAndWait">
    <param name="delay">500</param>
 </interceptor-ref>

The Action class looks something like:
public class LongAction extends ActionSupport {

private String formField;
public String getFormField() {
	return formField;
}
public void setFormField(String ff) {
	formField = ff;
}

public String execute() {
	if(formField == null || formField.length == 0) {
		return INPUT; //the form
	} else {
		//long task here
		return SUCCESS; //result page
	}
}

}

The delay on the interceptor is important because we need a chance to
return INPUT before being redirected to the wait page.

If anyone has a more elegant solutions please let me know.

Thanks,
-Chase

On Thu, Jul 17, 2008 at 11:41 AM, Karr, David <david.karr@wamu.net> wrote:
> I'm guessing the operation you're waiting for can take quite a while to
> complete.  Otherwise modifying the architecture of this probably
> wouldn't be worth it.
>
> You might consider the flow of the original action to simply report a
> simple "submitted and processing" result, and then implement an
> Ajax-based timeout to quickly check the status of the long-running
> process.
>
>> -----Original Message-----
>> From: Chase [mailto:chase@osdev.org]
>> Sent: Wednesday, July 16, 2008 4:23 PM
>> To: user@struts.apache.org
>> Subject: ExecAndWait (navigating back to the progress page)
>>
>> I want my users to be able to leave the wait page and return.
>> Can this be done, what is the best way?
>>
>> I've got two actions. ActionA displays a form and the form
>> submits to ActionB. ActionB is using the ExecAndWait
>> interceptor. Right now users have to resubmit the form to get
>> back to their status page (possibly resubmitting the form if
>> ActionB has finished). How can I have ActionA display the
>> wait page of ActionB instead of the form?
>>
>> Also, is there anyway to make the ExecAndWait interceptor
>> function per context instead per session? This is a low
>> volume internal app.
>>
>> Thanks,
>> Chase
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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


Mime
View raw message