This week's book giveaway is in the Java in General forum.
We're giving away four copies of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 and have ishori Sharan & Adam L Davis on-line!
See this thread for details.
Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

multiple concurrent ajax calls to multiple servlets

 
Greenhorn
Posts: 12
Firefox Browser Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey,

I am using AJAX at client side to make calls(POST calls) to multiple servlets of the same app. The spec requires an AJAX call to wait for some event to happen(at the server side) before this call completes. Meanwhile other AJAX calls are being made to some OTHER servlet(s) all of which get completed immediately.

The latter calls returns some data on completion without a hitch. However, when the former(the one which was waiting for an event) completes, it "tries" to return some data too, but it returns the output of the latter calls and that too more than once.

I am using POST for all these calls and suspect that "constant-handshaking" is behind all this. I have also tried flushing the stream but that didn't help either.

I am using Tomcat, chrome/mozilla and notepad.

If the problem is still not clear, I can post the code too.

Eagerly waiting,
Pankaj Kohli
 
Ranch Hand
Posts: 41
Google Web Toolkit Tomcat Server Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is this JSF issue ?
If so ajax requests can be pointed to different managed beans.
 
Funkaj Kohli
Greenhorn
Posts: 12
Firefox Browser Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No it was a logical error. I was using the same XMLHttpRequest() object to make multiple calls. So while the former AJAX waited for a response(on event onreadystatechange), the latter call made a new object and used it. Hence, I'd get the last completed response(ResponseText) on any former calls.

Got it yesterday.

I'm sorry for not removing the post.

Thank you for your time.
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic