• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Sending multiple request on a Single Click

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Frnds,

I have a question on sending multiple requests. Let's say I send multiple requests to the same servlet (Ofcourse two in my case) on a single click of button, is there a guarantee that those requests would be processed in the same order?
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No.
 
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But is it really possible to send multiple requests on a single button click?
Haven't tried it yet but I think the first request is processed and the
servlet will generate some response and the second request does not get a chance.

And Ravi please UseRealWords "Frnds" is not a real word.
 
Bear Bibeault
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Amit Ghorpade:
But is it really possible to send multiple requests on a single button click?

Sure it is. A click handler can be defined to fire off any number of requests to newly-opened windows, to iframes, as Ajax requests and so on.

In any case, the order of delivery to the server is completely nondeterministic.
 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And both requests will be processed in parallel, may I add.
 
Amit Ghorpade
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the explanation Bear,

Sure it is. A click handler can be defined to fire off any number of requests to newly-opened windows, to iframes, as Ajax requests and so on.


I am not familiar with a click handler
But can a click handler send multiple requests to a servlet?
If yes then I think after the first request, a response will be generated and as I said above the second request wont get a chance.
Is it like that some client side buffering is done for requests?
 
Bear Bibeault
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Amit Ghorpade:
[QBI am not familiar with a click handler[/QB]

A JavaScript function can be set up to handle clicks on any DOM element.

But can a click handler send multiple requests to a servlet?

Yes, as I explained. The client has no idea whether the request is being sent to a servlet or not. They're all just requests to the server.

If yes then I think after the first request, a response will be generated and as I said above the second request wont get a chance.

You are assuming that the browser will block waiting for the response. Not always. Not with Ajax and not with iframes.

Is it like that some client side buffering is done for requests?

There is some of that. Browsers will limit the number of simultaneous requests. How that's handled is browser-specific.
 
Amit Ghorpade
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for that great explanation Bear

Things are pretty clear for me now
 
Let's get him boys! We'll make him read this tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic