I'm interested in the answer to this one myself.  I was wondering if you
could use the Response object to stream status messages out to the user.
Has anybody done anything like that?

-----Original Message-----
From: Thomas Bednarz [mailto:[EMAIL PROTECTED]] 
Sent: Friday, March 01, 2002 11:58 AM
To: struts user list
Subject: ActionForward question

Hi,

Is it possible to send pages to a browser depending on the processing status
of an action? Lets say you have to process a long operation in the
background such as a credit card validation or the like, is it possible to
show the user an intermediate page telling him that some work is in progress
and then show the result page when it is generated?

In the Action class it looks like this:

        // test if session is valid
        af = super.validateForm(form, mapping, request);
        if (af != null) return af;
        // test if a form has already been delivered
        if ((ContainerName == null) || (ContainerName.length() < 1))  //show
form
        {
            saveToken(request);
            return (new
ActionForward("/Templates/Forms/ShowEnumNTGGForm.vm"));
        }

        if (this.isTokenValid(request))
        {
            resetToken(request);
            //
****************************************************************************
***********************
            //   START PROCESSING HERE THIS COULD LAST 30 SECONDS OR
MORE....
            //   IF I ADD SOMETHING LIKE A new ActionForward("some status
message URL"); THE
           //    FOLLOWING CODE WILL EXECUTE BUT THE FORWARD AT THE BOTTOM
WILL NEVER
           //     REACH THE BROWSER !
           //
****************************************************************************
***************************
            try
            {
                container = getNTContainer("Domain", ContainerName,
request);
                request.setAttribute("NTContainer", container);
            } catch (SmartSolException e)
            {
                errors.add(ActionErrors.GLOBAL_ERROR,
                           new ActionError("error.exception.smartsol", new
Integer(e.ErrorCode).toString(), e.File ,e.ErrorMsg));
            }
        } else
        {
            errors.add(ActionErrors.GLOBAL_ERROR, new
ActionError("error.BePatient"));
        }
        // Report any errors we have discovered back to the original form
        af = super.processErrors(errors, mapping, request);
        if (af != null)
        {
            log.debug("finished perform with errors.");
            return (af);
        }
        // Forward control to the specified success URI
        log.debug("finished perform with success");
        return (new ActionForward("/Templates/NTAccounts/EnumNTGG.vm"));
-------   end quote --------------------------

How can this problem be solved?

Many thanks!

Thomas


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

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

Reply via email to