Title: RE: Can anyone help with solving the "BACK" button problem, in th e browser?
well, this will blow all your socks off.
I got something to work, and remaining in line with my "REDUCE THE JAVASCRIPT" policy
here is what i did...
 
I just plugged some code into my actionhandler to evaluate a state property on my actionform. If it was a certain state i either perform usual processing or just by pass the processing and show the JSP which gets rebuilt anyways...
 
great!!
 
    public ActionHandlerResponse executeAction(ActionMapping mapping, ActionForm form, HttpServletRequest request){
 
        System.out.println("In " + this.getClass());
        actionFormObject = (Vat201ReturnActionForm)form;
        aRequest = request;
        ActionErrors errors = null;
        if (actionFormObject.getRefreshOption()){   // IF THIS IS TRUE DONT ALLOW ANY PROCESSING JUST REBUILD JSP
// THIS boolean GETS SET AFTER FIRST TIME PROCESSING
                return new ActionHandlerResponse(errors,mapping.findForward("success"));
        }
        errors = doFieldValidation();
        if (errors != null) {
            actionFormObject.setAction("Edit");
            return new ActionHandlerResponse(errors, new ActionForward(mapping.getInput()));
        }
        else {
            errors = doReturnUpdate();
            if (errors == null){
 
                return new ActionHandlerResponse(errors,mapping.findForward("success"));
            }
            else {
                actionFormObject.setAction("Edit");
                return new ActionHandlerResponse(errors, new ActionForward(mapping.getInput()));
            }
        }
        //return new ActionHandlerResponse(errors, mapping.findForward("mainMenu"));
    }
 
 
-----Original Message-----
From: Spencer Smith [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 07, 2001 7:44 PM
To: [EMAIL PROTECTED]
Subject: Re: Can anyone help with solving the "BACK" button problem, in th e browser?

That won't work.  I solved the problem using javascript.  Javascript doesn't cache like JSP pages does, so you can get around this problem using javascript.
 
If you want, I can send you the code I use.
----- Original Message -----
Sent: Thursday, June 07, 2001 10:12 AM
Subject: RE: Can anyone help with solving the "BACK" button problem, in th e browser?

Oops, I guess I should test before I post. It looks like newer browsers don't support this as a META tag only as a header.

I added the following to one of my action classes and the perform() method was called when I pressed 'Back':

response.addHeader("Pragma","no-cache");
response.addHeader("Cache-control","no-cache");

Hope it helps,
Thane

-----Original Message-----
From: Peter Alfors [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 07, 2001 11:35 AM
To: [EMAIL PROTECTED]
Subject: Re: Can anyone help with solving the "BACK" button problem, in
th e browser?


Thane ,

I am using:
    <META http-equiv="Expires" content="now">
in my header, and my action is not re-executed when I use the browser
back button.
Is there another option I should be using?

thanks,
    Pete


Thane Eisener wrote:

>
>
> I seem to recall a META tag called something like pragma-no-cache that
> you can embed in your page which will force the page to reload (not
> just display a snapshot). This should enable handling the situation in
> scriptlets or your action class.
>
> -----Original Message-----
> From: Peter Alfors [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, June 07, 2001 9:52 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Can anyone help with solving the "BACK" button problem,
> in
> the browser?
>
> Depending on which browser you use, and the data on the page, the back
> button
> may cause (or ask) the page to reload.
> However, some browsers (like IE) only display a snapshot of what the
> last page
> rendered to.
> Therefore, you cannot use scriptlets or the action class.  However,
> you are able
> to kick-off javascript.
> If you can gaurantee that your users will have javascript enabled, you
> can write
> a simple test to see if this page was already displayed to the user.
> You could
> check a flag (hidden field) when the page loads.  If the flag is true,
> then use
> the javascript to reload to your desired page.
>
> HTH,
>     Pete
>
> "Dudley Butt@i-Commerce" wrote:
>
> > Please help,
> >
> > When the user pushes the back button, I want the page to redirect or
> refresh
> > to a different page, please, any ideas?
> >
> > Thanx guys and gals
> > Dudley

Reply via email to