Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > refresh without request parameters?

Reply
Thread Tools

refresh without request parameters?

 
 
Bo Rasmussen
Guest
Posts: n/a
 
      10-08-2004
Hi,

I have a problem : I have a form with some buttons. When one of these
buttons is pressed a new URL with some parameters to e.g. delete something
from a database. The problem is that when the user presses refresh that same
URL is fired with the parameters to delete again - this sometimes gives
strange behaviour. Is there any way that I can stip of parameters when
reloading a page such that only the webpage is deleted e.g.

http://myserver/mypage.jsp?delete=yes

becomes

http://myserver/mypage.jsp

Or should this be handled some other way??

Regards
Bo


 
Reply With Quote
 
 
 
 
Philip Ronan
Guest
Posts: n/a
 
      10-08-2004
On 8/10/04 2:10 pm, Bo Rasmussen wrote:

> Hi,
>
> I have a problem : I have a form with some buttons. When one of these
> buttons is pressed a new URL with some parameters to e.g. delete something
> from a database. The problem is that when the user presses refresh that same
> URL is fired with the parameters to delete again - this sometimes gives
> strange behaviour. Is there any way that I can stip of parameters when
> reloading a page such that only the webpage is deleted e.g.
>
> http://myserver/mypage.jsp?delete=yes
>
> becomes
>
> http://myserver/mypage.jsp
>
> Or should this be handled some other way??


Ask Google about cookies and session IDs.

--
Philip Ronan

(Please remove the "z"s if replying by email)


 
Reply With Quote
 
 
 
 
Bo Rasmussen
Guest
Posts: n/a
 
      10-08-2004
Hi Philip,

Could you please sketch what a solution should look like - that would help
me a lot before I start looking into the large number of hits I get from
from google? Thanks in advance

Regards
Bo Rasmussen


"Philip Ronan" <> wrote in message
news:BD8C5160.2333F%...
> On 8/10/04 2:10 pm, Bo Rasmussen wrote:
>
> > Hi,
> >
> > I have a problem : I have a form with some buttons. When one of these
> > buttons is pressed a new URL with some parameters to e.g. delete

something
> > from a database. The problem is that when the user presses refresh that

same
> > URL is fired with the parameters to delete again - this sometimes gives
> > strange behaviour. Is there any way that I can stip of parameters when
> > reloading a page such that only the webpage is deleted e.g.
> >
> > http://myserver/mypage.jsp?delete=yes
> >
> > becomes
> >
> > http://myserver/mypage.jsp
> >
> > Or should this be handled some other way??

>
> Ask Google about cookies and session IDs.
>
> --
> Philip Ronan
>
> (Please remove the "z"s if replying by email)
>
>



 
Reply With Quote
 
Ivo
Guest
Posts: n/a
 
      10-08-2004
"Bo Rasmussen" wrote

> I have a problem : I have a form with some buttons. When one of these
> buttons is pressed a new URL with some parameters to e.g. delete something
> from a database. The problem is that when the user presses refresh that

same
> URL is fired with the parameters to delete again - this sometimes gives
> strange behaviour. Is there any way that I can stip of parameters when
> reloading a page such that only the webpage is deleted e.g.
>
> http://myserver/mypage.jsp?delete=yes
>
> becomes
>
> http://myserver/mypage.jsp
>
> Or should this be handled some other way??


Absolutely. This is exactly why they invented GET and POST as two very
different forms submission methods. The GET method, with parameters attched
to an url, is fine when requesting information from a database, but to
modify that database one should always use POST. Spelled out url's are
bookmarked, show up in referrer logs, some spiders interpret GETted forms,
.... What if everytime the Googlebot crawled your page something was deleted
from your database?
HTH
--
Ivo


 
Reply With Quote
 
Bo Rasmussen
Guest
Posts: n/a
 
      10-08-2004
Hello Ivo,

That sure helps - thanks ;o)

I can see that stuff like

<a href=\"" + request.getRequestURI() + "?delete=yes\">

are shattered all over the place. Is there any way that I can quickly
replace these with stuff that uses POST.

I know I can insert buttons for this purpose - but isn't there a way to make
links that POST.

Regards
Bo Rasmussen

"Ivo" <> wrote in message
news:416695dc$0$76526$...
> "Bo Rasmussen" wrote
>
> > I have a problem : I have a form with some buttons. When one of these
> > buttons is pressed a new URL with some parameters to e.g. delete

something
> > from a database. The problem is that when the user presses refresh that

> same
> > URL is fired with the parameters to delete again - this sometimes gives
> > strange behaviour. Is there any way that I can stip of parameters when
> > reloading a page such that only the webpage is deleted e.g.
> >
> > http://myserver/mypage.jsp?delete=yes
> >
> > becomes
> >
> > http://myserver/mypage.jsp
> >
> > Or should this be handled some other way??

>
> Absolutely. This is exactly why they invented GET and POST as two very
> different forms submission methods. The GET method, with parameters

attched
> to an url, is fine when requesting information from a database, but to
> modify that database one should always use POST. Spelled out url's are
> bookmarked, show up in referrer logs, some spiders interpret GETted forms,
> ... What if everytime the Googlebot crawled your page something was

deleted
> from your database?
> HTH
> --
> Ivo
>
>



 
Reply With Quote
 
Edwin Martin
Guest
Posts: n/a
 
      10-08-2004
Bo Rasmussen wrote:
> Hello Ivo,
>
> That sure helps - thanks ;o)
>
> I can see that stuff like
>
> <a href=\"" + request.getRequestURI() + "?delete=yes\">
>
> are shattered all over the place. Is there any way that I can quickly
> replace these with stuff that uses POST.
>
> I know I can insert buttons for this purpose - but isn't there a way to make
> links that POST.
>
> Regards
> Bo Rasmussen
>
> "Ivo" <> wrote in message
> news:416695dc$0$76526$...
>
>>"Bo Rasmussen" wrote
>>
>>
>>>I have a problem : I have a form with some buttons. When one of these
>>>buttons is pressed a new URL with some parameters to e.g. delete

>
> something
>
>>>from a database. The problem is that when the user presses refresh that

>>
>>same
>>
>>>URL is fired with the parameters to delete again - this sometimes gives
>>>strange behaviour. Is there any way that I can stip of parameters when
>>>reloading a page such that only the webpage is deleted e.g.
>>>
>>>http://myserver/mypage.jsp?delete=yes


Another option is to do a redirect in the mypage.jsp?delete=yes page,
for example to mypage.jsp or mypage.jsp?deleted=yes (mind the extra "d").

That way a reload won't delete a thing.

Edwin Martin

--
http://www.bitstorm.org/edwin/en/
 
Reply With Quote
 
Ivo
Guest
Posts: n/a
 
      10-08-2004
"Edwin Martin" wrote
> Bo Rasmussen wrote:
> > "Ivo" wrote
> >>"Bo Rasmussen" wrote
> >>>URL is fired with the parameters to delete again - this sometimes gives
> >>>strange behaviour. Is there any way that I can stip of parameters when
> >>>reloading a page such that only the webpage is deleted e.g.
> >>>
> >>>http://myserver/mypage.jsp?delete=yes

>
> Another option is to do a redirect in the mypage.jsp?delete=yes page,
> for example to mypage.jsp or mypage.jsp?deleted=yes (mind the extra "d").
>
> That way a reload won't delete a thing.


No no no. You 're missing the point. It is dangerous, not to say suicidal,
to have a serverside script waiting for such url's to 'update' the database.
You never know who (or what) might read those url's because there is no
way you can keep them for yourself.

> > I can see that stuff like
> >
> > <a href=\"" + request.getRequestURI() + "?delete=yes\">
> >
> > are shattered all over the place. Is there any way that I can quickly
> > replace these with stuff that uses POST.
> >
> > I know I can insert buttons for this purpose - but isn't there a way to
> > make links that POST.


You can "document.forms['myformwithPOSTmethod'].submit()" onclick using
javascript. But I 'd see that as a temporary solution while you rewrite your
pages, as there really is no need to rely on javascript for this.
HTH
--
Ivo




 
Reply With Quote
 
Bo Rasmussen
Guest
Posts: n/a
 
      10-12-2004
Hmm,

Now I've changed everything such that all actions taken when the user press
a button results in a POST request. But the problem remains - when the user
refreshes the page the same request is fired again. The address line in IE
says

http://myserver/mypage.jsp

but it seems a POST request is fired with parameters

http://myserver/mypage.jsp?delete=yes

any help is appreciated

Regards
Bo




"Ivo" <> wrote in message
news:416695dc$0$76526$...
> "Bo Rasmussen" wrote
>
> > I have a problem : I have a form with some buttons. When one of these
> > buttons is pressed a new URL with some parameters to e.g. delete

something
> > from a database. The problem is that when the user presses refresh that

> same
> > URL is fired with the parameters to delete again - this sometimes gives
> > strange behaviour. Is there any way that I can stip of parameters when
> > reloading a page such that only the webpage is deleted e.g.
> >
> > http://myserver/mypage.jsp?delete=yes
> >
> > becomes
> >
> > http://myserver/mypage.jsp
> >
> > Or should this be handled some other way??

>
> Absolutely. This is exactly why they invented GET and POST as two very
> different forms submission methods. The GET method, with parameters

attched
> to an url, is fine when requesting information from a database, but to
> modify that database one should always use POST. Spelled out url's are
> bookmarked, show up in referrer logs, some spiders interpret GETted forms,
> ... What if everytime the Googlebot crawled your page something was

deleted
> from your database?
> HTH
> --
> Ivo
>
>



 
Reply With Quote
 
Bo Rasmussen
Guest
Posts: n/a
 
      10-12-2004
Now I have changed it so that requests are POST. But still the problem
remain! When the user refrehes that same POST request is fired again! The IE
address line says http://myserver/mypage.jsp but
http://myserver/mypage.jsp?delete=yes
is fired???

Regards
Bo

"Ivo" <> wrote in message
news:416695dc$0$76526$...
> "Bo Rasmussen" wrote
>
> > I have a problem : I have a form with some buttons. When one of these
> > buttons is pressed a new URL with some parameters to e.g. delete

something
> > from a database. The problem is that when the user presses refresh that

> same
> > URL is fired with the parameters to delete again - this sometimes gives
> > strange behaviour. Is there any way that I can stip of parameters when
> > reloading a page such that only the webpage is deleted e.g.
> >
> > http://myserver/mypage.jsp?delete=yes
> >
> > becomes
> >
> > http://myserver/mypage.jsp
> >
> > Or should this be handled some other way??

>
> Absolutely. This is exactly why they invented GET and POST as two very
> different forms submission methods. The GET method, with parameters

attched
> to an url, is fine when requesting information from a database, but to
> modify that database one should always use POST. Spelled out url's are
> bookmarked, show up in referrer logs, some spiders interpret GETted forms,
> ... What if everytime the Googlebot crawled your page something was

deleted
> from your database?
> HTH
> --
> Ivo
>
>



 
Reply With Quote
 
Bo Rasmussen
Guest
Posts: n/a
 
      10-12-2004
Hi Edwin Martin,

Thanks - that really did the job. Following a POST request (which may have
changed the database) I redirect to mypage.jsp.


Best regards
Bo Rasmussen
"Edwin Martin" <> wrote in message
news:6Fz9d.3450$...
> Bo Rasmussen wrote:
> > Hello Ivo,
> >
> > That sure helps - thanks ;o)
> >
> > I can see that stuff like
> >
> > <a href=\"" + request.getRequestURI() + "?delete=yes\">
> >
> > are shattered all over the place. Is there any way that I can quickly
> > replace these with stuff that uses POST.
> >
> > I know I can insert buttons for this purpose - but isn't there a way to

make
> > links that POST.
> >
> > Regards
> > Bo Rasmussen
> >
> > "Ivo" <> wrote in message
> > news:416695dc$0$76526$...
> >
> >>"Bo Rasmussen" wrote
> >>
> >>
> >>>I have a problem : I have a form with some buttons. When one of these
> >>>buttons is pressed a new URL with some parameters to e.g. delete

> >
> > something
> >
> >>>from a database. The problem is that when the user presses refresh that
> >>
> >>same
> >>
> >>>URL is fired with the parameters to delete again - this sometimes gives
> >>>strange behaviour. Is there any way that I can stip of parameters when
> >>>reloading a page such that only the webpage is deleted e.g.
> >>>
> >>>http://myserver/mypage.jsp?delete=yes

>
> Another option is to do a redirect in the mypage.jsp?delete=yes page,
> for example to mypage.jsp or mypage.jsp?deleted=yes (mind the extra "d").
>
> That way a reload won't delete a thing.
>
> Edwin Martin
>
> --
> http://www.bitstorm.org/edwin/en/



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
JSP: Session parameters vanish on refresh. How do I keep them on refresh? Per Magnus L?vold Java 1 10-08-2004 02:52 PM
How do i refresh a datagrid from a pop up window without having to refresh the whole page? Pkenty ASP .Net Web Controls 0 05-28-2004 07:06 AM
Re: Accessing Request.InputStream / Request.BinaryRead *as the request is occuring*: How??? Brian Birtle ASP .Net 2 10-16-2003 02:11 PM
using refresh button on the menu bar to refresh two frames. Jawahar Rajan ASP General 1 10-01-2003 09:20 PM
Problem with refresh button breaking automatic refresh brian lanning ASP .Net 0 07-29-2003 07:57 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57