Duplicate submission prevention

C

cool2005

The problem is users double or trible click at the submit button.
The requirement is we need to ignore all the submission except the
first one.

A "ordinary" way to do this is to set

setSynchronizeOnSession(true);
setSessionForm(true);

in SimpleFormController. This will make the request syn and make trying
to
use the form residing in session.

But the issue is how can I ignore the requests other than the first.

I am new to Spring MVC. In Struts, I can simply return null as the
Forward so that browser recieves none response (or just a header that
doesn't cause
browser to update the screen).

In Spring MVC, it will forward to a blank page if I return null as
ModelAndView.

Two questions:

1). Is there a way in Spring MVC to "cancel" a request.
2). Is there a better way to prevent duplicated submission in my case.

Thanks

mark
 
A

Andrew Thompson

cool2005 said:
The problem is users double or trible click at the submit button.

browser friendly failsafe..
<blockquote>
Only click the button a <b>single</b> time
(unless you wish to be billed twice!).
</blockquote>

Andrew T.
 
M

Manish Pandit

Hi,

If this is a struts application, you can use the saveToken() and
isTokenValid() API in your execute() to ensure that you get (or
process!) no duplicate submits. You can google this up for exact usage,
but this is pretty much all you can do from a server side standpoint.
If it is non-struts, you can try to implement the token functionality
in your app in a helper class or so.

-cheers,
Manish
 
C

cool2005

Manish, the problem is not detecting the duplicated submission (I was
able to detect
them without problem) but how to cancel the requests after the first
one.

Here is the question:

How can I cancel a request in Spring MVC? (I can do it in Struts by
returning
null as Forward)

thanks

mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top