Simple redirection does not do the same job, because the /step/1/error
page is not a simple error page - I would like it to reload the same form in
step 1 with the values filled and some message indicating what's to be
correct.

Looks like the network trip (redirect/refresh) can not be avoid. Then the
session mechanism maybe better for the speed since it sends less data.

Harry


----- Original Message -----
From: "Peter Bi" <[EMAIL PROTECTED]>
To: "Harry Zhu" <[EMAIL PROTECTED]>; <>
Sent: Friday, August 09, 2002 5:18 PM
Subject: Re: Is it possible to change the browser's address/location URL
without Redirect?


> It is the browser that controls the URL in the "Address" bar. So one has
to
> make another call to get the URL refreshed. If you are worry about the
> speed, you may
>
> 1) return an error code in case of error
> 2) in Apache's httpd.conf, config that specific error to display
> /step/1/error
>
> A simply redirection does the same job.
>
> Peter
>
> ----- Original Message -----
> From: "Harry Zhu" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, August 09, 2002 11:26 AM
> Subject: Is it possible to change the browser's address/location URL
without
> Redirect?
>
>
> > Looks like my explanation is too long or too bad.
> > The simple idea is in page step 1, after the
> >
> > <form action=/step/2 method=post>...</form>
> >
> > submitted, I want the browser show something
> > http://www.example.com/step/1/error, instead of
> > http://www.example.com/step/2,
> > if there is a need for user to correct the data submitted.
> >
> > It might be accomplished by using one of the approaches outlined below,
> but
> > I was wondering if there's other way that can save the overhead of the
> > write/read or resend the data, and the re-process. Probably not much we
> can
> > do if the URL displayed in the browser's address/location bar depends
only
> > on the action value of the form submitted, not based on the server
> response?
> >
> > Harry
> >
> >
> >
> > ----- Original Message -----
> > From: "Harry Zhu" <[EMAIL PROTECTED]>
> > To: "mod_perl list" <[EMAIL PROTECTED]>
> > Sent: Thursday, August 08, 2002 4:22 PM
> > Subject: Can I change the browser's address/location?
> >
> >
> > > Suppose I have a generic content handler to handle requst
> > > /step/1, /step/2, ..., /step/n
> > >
> > > <Location /step>
> > >       SetHandler perl-script
> > >       PerlHandler MyHandler
> > >
> > > </Location>
> > >
> > > #MyHandler.pm
> > > package MyHandler;
> > > sub handler {
> > >   my $r=shift;
> > >   my $step = substr($r->path_info(),1);
> > >
> > >   #do something before fetch the content
> > >
> > >   #fetch content: usually include a form that will assign action
> > > /step/($step+1)
> > >
> > > }
> > >
> > > So if everything goes well, the user will follow through from step 1,
> step
> > > 2, until fnish.
> > > Now if in the "#do something ..." part, something is wrong, it will
> > usually
> > > require user go back to the same step, for example, to fill the form
> > again.
> > > The way my old cgi script does is just generate the form with
prefilled
> > > value plus some error message indicate what's wrong. It works ok but
the
> > > browser location will show /step/($step+1) while it actually is
> > /step/$step.
> > > Now that I am working it on mod-perl I thought I should be able to do
> > > something about it. I briefly browsed the 2 mod-perl books (eagle,
> > > cookbook), and could not found a simple solution yet  (or I missed
it?).
> I
> > > was think using one of the folowing might work:z
> > > 1) save the request data in a temp file and redirect or http-refresh
to
> > > /step/$step?$session_id or /step/$step/error?$session_id
> > > Remember the content is dynamic and depend on the input form data, so
> > simple
> > > redirect may not work.
> > > Looks like Apache will not post the form data when redirect with
> Location?
> > >
> > > 2) print a short form with hidden data and assign
> action=/step/$step/error
> > > then submit right away (onload=form.submit()?)
> > >
> > > Does anybody have a simple solution, e.g. without redirect? Is it
> possible
> > > to change the URI showing in the browser's address/location bar?
> > >
> > > I would appreciated if somebody can pointer me to the right direction.
> > >
> > > Harry
> > >
> > >
> >
> >
>


Reply via email to