You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by eyalbenamram <ey...@gmail.com> on 2008/11/10 15:27:36 UTC

force client to use GET method

Hi
How do I tell the client to use a GET method instead of POST?
The problem is, the client is sending the form from a previous page
in a POST request, causing a double submission.
-- 
View this message in context: http://www.nabble.com/force-client-to-use-GET-method-tp20420920p20420920.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: force client to use GET method

Posted by eyalbenamram <ey...@gmail.com>.
Sorry, this seemed like two different ways that may solve the same problem.
anyway, problem solved. Thanks for your great support!

igor.vaynberg wrote:
> 
> why did you start another thread about this? please dont spawn more
> then one thread for the same problem.
> 
> -igor
> 
> On Mon, Nov 10, 2008 at 6:27 AM, eyalbenamram <ey...@gmail.com>
> wrote:
>>
>> Hi
>> How do I tell the client to use a GET method instead of POST?
>> The problem is, the client is sending the form from a previous page
>> in a POST request, causing a double submission.
>> --
>> View this message in context:
>> http://www.nabble.com/force-client-to-use-GET-method-tp20420920p20420920.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/force-client-to-use-GET-method-tp20420920p20423712.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: force client to use GET method

Posted by Igor Vaynberg <ig...@gmail.com>.
why did you start another thread about this? please dont spawn more
then one thread for the same problem.

-igor

On Mon, Nov 10, 2008 at 6:27 AM, eyalbenamram <ey...@gmail.com> wrote:
>
> Hi
> How do I tell the client to use a GET method instead of POST?
> The problem is, the client is sending the form from a previous page
> in a POST request, causing a double submission.
> --
> View this message in context: http://www.nabble.com/force-client-to-use-GET-method-tp20420920p20420920.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: force client to use GET method

Posted by Piller Sébastien <pi...@hmcrecord.ch>.
store a flag in the form that change to true when the form is submitted.

then, in onsubmit, check "if(myflag) { return;}"

should work... ugly but should work


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: force client to use GET method

Posted by Jeremy Thomerson <je...@wickettraining.com>.
Can you give more details on what you mean by submitting the form of the
previous page again?

Is this:
1 - the user is clicking the submit button, and then clicking again before
the page every changes?
2 - the form is being submitted, and the user is doing refresh / etc / to
resubmit?

Number two is handled by default by Wicket using the redirect to buffer
strategy, unless you have modified settings otherwise.


-- 
Jeremy Thomerson
http://www.wickettraining.com


On Mon, Nov 10, 2008 at 8:46 AM, eyalbenamram <ey...@gmail.com>wrote:

>
> Ok.. that didn't stop the client from submitting the form of the previous
> page again.
> Any other solutions to preventing double submissions?
>
>
> Pills wrote:
> >
> > write it in html?
> >
> > <form wicket:id="foo" method="GET">...
> >
> > eyalbenamram a écrit :
> >> Hi
> >> How do I tell the client to use a GET method instead of POST?
> >> The problem is, the client is sending the form from a previous page
> >> in a POST request, causing a double submission.
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/force-client-to-use-GET-method-tp20420920p20421291.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: SV: force client to use GET method

Posted by eyalbenamram <ey...@gmail.com>.
Thanks!!

Wilhelmsen Tor Iver wrote:
> 
>> Ok.. that didn't stop the client from submitting the form of 
>> the previous page again. 
>> Any other solutions to preventing double submissions?
> 
> Tell people to use a less stupid browser than IE? (Which is the one with
> that behavior if memory serves)? :)
> 
> Real solution: Use a "hidden" token that you use to check whether the
> particular form already has been posted, and in that case just skip the
> form processing and work on the already processed object, something like
> this in onSubmit():
> 
> // Map<String, DataObject> objectmap...
> 
> // Form<DataObject>
> 
> String tokenvalue = form.get("token");
> DataObject obj = objectmap.get(tokenvalue);
> if (obj == null) {
>     // Not already handled
>     obj = this.getModelObject();
>     // TODO Persist or whatever
>     // Put in map
>     objectmap.put(tokenvalue, obj);
> }
> // TODO Operate on obj
> 
> Instead of this thrown-together example using an objectmap (which will
> get filled with "garbage"), use the session.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/force-client-to-use-GET-method-tp20420920p20422599.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


SV: force client to use GET method

Posted by Wilhelmsen Tor Iver <To...@arrive.no>.
> Ok.. that didn't stop the client from submitting the form of 
> the previous page again. 
> Any other solutions to preventing double submissions?

Tell people to use a less stupid browser than IE? (Which is the one with
that behavior if memory serves)? :)

Real solution: Use a "hidden" token that you use to check whether the
particular form already has been posted, and in that case just skip the
form processing and work on the already processed object, something like
this in onSubmit():

// Map<String, DataObject> objectmap...

// Form<DataObject>

String tokenvalue = form.get("token");
DataObject obj = objectmap.get(tokenvalue);
if (obj == null) {
    // Not already handled
    obj = this.getModelObject();
    // TODO Persist or whatever
    // Put in map
    objectmap.put(tokenvalue, obj);
}
// TODO Operate on obj

Instead of this thrown-together example using an objectmap (which will
get filled with "garbage"), use the session.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: force client to use GET method

Posted by eyalbenamram <ey...@gmail.com>.
Ok.. that didn't stop the client from submitting the form of the previous
page again. 
Any other solutions to preventing double submissions?


Pills wrote:
> 
> write it in html?
> 
> <form wicket:id="foo" method="GET">...
> 
> eyalbenamram a écrit :
>> Hi
>> How do I tell the client to use a GET method instead of POST?
>> The problem is, the client is sending the form from a previous page
>> in a POST request, causing a double submission.
>>   
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/force-client-to-use-GET-method-tp20420920p20421291.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: force client to use GET method

Posted by Jeremy Thomerson <je...@wickettraining.com>.
Or the method described here:
http://www.nabble.com/form-GET-calling-onSubmit-td19824816.html



-- 
Jeremy Thomerson
http://www.wickettraining.com

On Mon, Nov 10, 2008 at 8:38 AM, Piller Sébastien <pi...@hmcrecord.ch>wrote:

> write it in html?
>
> <form wicket:id="foo" method="GET">...
>
> eyalbenamram a écrit :
>
>> Hi
>> How do I tell the client to use a GET method instead of POST?
>> The problem is, the client is sending the form from a previous page
>> in a POST request, causing a double submission.
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: force client to use GET method

Posted by Piller Sébastien <pi...@hmcrecord.ch>.
write it in html?

<form wicket:id="foo" method="GET">...

eyalbenamram a écrit :
> Hi
> How do I tell the client to use a GET method instead of POST?
> The problem is, the client is sending the form from a previous page
> in a POST request, causing a double submission.
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org