输入banner图图片脚本导航/分类

通过ajax访问Tomcat服务器web service接口时出现No 'Access-Control-Allow-Origin' header问题的解决办法

cors-filter-2.4.jar java-property-utils-1.9.1.jar

2、在web.xml中添加CorsFilter过滤器

<filter>
    <filter-name>CorsFilter</filter-name>
    <filter-class>com.thetransactioncompany.cors.CORSFilter</filter-class>
</filter>
<filter-mapping>
      <filter-name>CorsFilter</filter-name>
      <url-pattern>/*</url-pattern>
</filter-mapping>
<filter>

3、重启Web服务器即可。

 

参考资料

1、http://stackoverflow.com/questions/17267023/tomcat-7-cors-filter

2、http://software.dzhuvinov.com/cors-filter-installation.html

通过ajax访问Tomcat服务器web service接口时出现No 'Access-Control-Allow-Origin' header问题的解决办法

标签: