Access-Control-Allow-Origin error

簡単なWebアプリを作っていて、AJAX通信で以下のエラーが出たら、

No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'null' is therefore not allowed access


返すHTTPレスポンスヘッダに、以下を付ければ良い。

Access-Control-Allow-Origin 属性値として、'*' を指定

JavaServter-API なら、
 HttpServletResponse#addHeader("Access-Control-Allow-Origin","*");


ということ。