Reverse Ajax + JSP-Servlet

后端 未结 2 1497
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-03 13:00

We are trying to create a reverse ajax in our project.

I\'ve checked on the net and didn\'t find something concrete. I was unable to run any of the tutorials provide

相关标签:
2条回答
  • 2021-01-03 13:43

    Here is a valuable resource

    0 讨论(0)
  • 2021-01-03 13:48

    The HTTP protocol (fortunately, after all) doesn't support PUSH, so it stops there.

    Best what you can do is to let the client fire ajax poll requests at timed intervals I can recommend jQuery.ajax() in combination with setInterval() for this.

    Alternatively (and with a bit more effort) you could make use of Comet technique (which simulates the fictive HTTP PUSH less or more). Check the appserver specific documentation/wiki using this keyword for details. Here's a Tomcat targeted example: http://wiki.apache.org/tomcat/WhatIsComet

    Edit: as requested, here's a Tomcat+Comet tutorial to get started: http://www.ibm.com/developerworks/web/library/wa-cometjava/#N100CC Hope this helps.

    0 讨论(0)
提交回复
热议问题