http
power174
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
request.getSession().getAttribute获取值为null
控制器A中request.getSession().setAttribute,在B控制器中getAttribute获取到的是null 这个是因为在前后端分离架构中,使用vue、angular 等发送ajax存在跨域请求没有携带请求凭证(cookie、HTTP认证及客户端SSL证明)造成request.getSession()获取的是不同的sessionId。 解决方法 在前端axios里加上axios.defaults.withCredentials = true; ...原创 2020-05-22 11:16:51 · 10450 阅读 · 9 评论 -
主流解决前后端跨域问题
两种方式:一、前端处理,二、后端处理 spring-boot 后端处理: package com.app.course.config; //跨域处理 import org.springframework.context.annotation.Configuration; import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.servlet.config.annotation.CorsRegi原创 2020-05-14 11:16:37 · 273 阅读 · 0 评论
分享