How to stop a browser to cache a web page or ajax-response in java web appplications

In my recent web project, my pages were working well. But one of ajax call response was not working correctly. I figured out, the response I was getting was a cache copy returned by browser. If you are in same situation or wish the browser do not cache a particular web page or an ajax response. Here is the solution:

Just set "Cache-Control" header to "no-cache", in HttpServletResponse, like this:
response.setHeader("Cache-Control", "no-cache");