?
Solved

Preventing multiple HTTP request to a Servlet

Posted on 2003-03-26
3
Medium Priority
?
178 Views
Last Modified: 2013-11-24
My problem is, I have a user which sometimes clicks multiple times on a HTTP link. When they do this it causes multiple requests/threads to be sent to the Servlet. All of these requests are fully processed by the backend.

I know one way of preventing this from happening, i.e. JavaScript, but this is unacceptable for this solution. I also tried setting a parameter in the session and returning from the method when it is set, but this just generates a blank page on the second which arrives before the first has finished.

Any help or suggestions would be greatly appreciated.

Kindest regards,
Damien
0
Comment
Question by:dglancy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 35

Expert Comment

by:girionis
ID: 8210534
 Thsi article explains how you can avoid duplicate form submissions. You might be able to adapt it for multiple clicks on links.
0
 
LVL 35

Accepted Solution

by:
girionis earned 1500 total points
ID: 8210536
0
 
LVL 9

Expert Comment

by:Venci75
ID: 8210884
public void doPost(HttpServletRequest req, HttpServletResponse resp) {
    if (req.getSession().getAttribute("processing") != null) {
        req.getSession().setAttribute("processing", new Object());
        try {
            //process the request
        } finally {
            req.getSession().setAttribute("processing", null);
        }
    }
...
0

Featured Post

Interactive Way of Training for the AWS CSA Exam

An interactive way of learning that will help you visualize core concepts so that you can be more effective when taking your AWS certification exam.  Built for students by a student to help them understand the concepts that they are being taught.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses
Course of the Month7 days, 20 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question