This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

multiple concurrent ajax calls to multiple servlets

 
Funkaj Kohli
Greenhorn
Posts: 12
Firefox Browser Java Ubuntu
  • Mark post as helpful
  • send pies
  • 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
 
H Jetly
Ranch Hand
Posts: 41
Google Web Toolkit Redhat Tomcat Server
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic