ajax跨域问题
程序员文章站
2022-04-01 23:30:11
在java代码的方法里面增加响应头: @RequestMapping(value="getCode.html") @ResponseBody public List
在java代码的方法里面增加响应头:
@RequestMapping(value="getCode.html")
@ResponseBody
public List<Map<Object,Object>> getCode(ServletRequest request, ServletResponse resp) throws IOException, ServletException{
HttpServletResponse response = (HttpServletResponse) resp;
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Methods", "POST, PUT, GET, OPTIONS, DELETE");
上一篇: WUOJ-ACM :1003: 零起点学算法78——牛牛
下一篇: 大数据带来的四种思维