thanx Steve.

>> From memory, cflocation uses headers to to the redirect

yes. Error 302 "page has temporarily moved". Same as ASP's
response.redirect(url) whereas getPageContext().forward is more like
ASP's server.transfer(filename)
 
that at least makes sense. the page is still loaded in memory, inc the
submitted form so the server side re-direct really just loads the new
page in at that point. 

you're right - clearing the FORM scope would clear this up. 

Because the FORM scope is effectively shared at that point then it's as
if it's a server side include (but there's one of them available at the
java level anyway)

well this clears this up in any case. thanx again

cheers
barry.b


-----Original Message-----
From: Steve Onnis [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, 28 April 2004 5:48 PM
To: CFAussie Mailing List
Subject: [cfaussie] RE: getPageContext().forward() wierdness

barry

>From memory, cflocation uses headers to to the redirect, thus you loose
all
your server vars including your form scope

getPageContext().forward(thispage & "?action=addnew"); does it
serverside
basically telling the server to, when its done processing, to do to that
page rather than the page defined in the original headers, so your not
actually leaving the cf servers environment in this case, thus holding
onto
your form scope.

you may have to clear the form scope before you call the redirect, or
write
a little CFFUNCTION that calls the getPageContext.... so you can still
call
a redirect from your cfscript

Steve

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Barry
Beattie
Sent: Tuesday, April 27, 2004 4:39 PM
To: CFAussie Mailing List
Subject: [cfaussie] getPageContext().forward() wierdness


Hi all

I'm using this in CFScript:

getPageContext().forward(thispage & "?action=addnew");

to reload the page after a save for a new form display. Trouble is that
it, with the logic I'm using (below), it seems to want to go around
again, like the FORM scope persists. Going back to CFLOCATION works
fine.

Can this happen? Because this is a server-side re-direct (reload the
target page), can the FORM scope still persist after getPageContext is
called?

the main page processing logicw when the form submitted

<cfscript>

        objRequisition = createobject("component", "XXX").init(dsnInfo,
cmpy);
        if (isDefined("form.fieldnames")){
                if (isNew){ // NEW
                        setObjPropertiesFromForm(objRequisition);
                        objRequisition.AddNew();
                }else if(isEdit){ // EDIT
                        setObjPropertiesFromForm(objRequisition);

                        objRequisition.Update();
                }else{
                        abort();
                }
                getPageContext().forward(thispage & "?action=addnew");
// reload this page for a new requisition


        }else{
                if (isNew){ // new requisition
                        fillFormFromDefaults();
                }else if(isEdit){ // from link
                        objRequisition.get(URL.req);
                        fillFormFromObject(objRequisition);

                }else{
                        abort();
                }
        }
</cfscript>




---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
[EMAIL PROTECTED]

MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004


---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
[EMAIL PROTECTED]

MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004


---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004

Reply via email to