Tomcat 给出相同的响应 [英] Tomcat gives Same Response
问题描述
我正在使用 ajax 向使用 tomcat Web 服务器的 servlet 发送请求.首先我发送一个请求,它从 servlet 得到响应,然后我调用那个 ajax 来使用相同的 uri 向 servlet 发送一个请求,tomcat 没有调用我的 servlet 它发送以前的响应.
I am using ajax for sending request to a servlet using tomcat web server. first i send a request and it gets response from the servlet and then i call the that ajax for send a request to servlet using the same uri, tomcat does not invoke my servlet it send the previous response.
最初我要做的是,当我的页面对ajax请求在一段时间后转到servlet时,它给我响应.当我刷新或重新运行应用程序时,它不会向 servlet 发送请求对象,tomcat 直接将先前的响应发送给 ajax.
originally what i am do, is that when my page to ajax request is go to servlet after some time its give response to me. when i refresh or re run the application it does not send request object for servlet, tomcat directly send previous reponse to ajax.
推荐答案
我的猜测是不是 Tomcat 向您发送了相同的响应,而是您的浏览器缓存.尝试使用 POST 而不是 GET,或使用 jQuery 的 cache
设置(或类似的技巧)以防止浏览器缓存.
My guess is that it's not Tomcat that sends you the same response, but your browser cache. Try using a POST instead of a GET, or use jQuery's cache
setting (or a similar trick) to prevent caching from the browser.
这篇关于Tomcat 给出相同的响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!