怎么在SpringMvc拦截器或者request中取得前端传递过来的Json数据

2024-12-29 11:45:01
推荐回答(2个)
回答1:

public String readJSONString(HttpServletRequest request){ StringBuffer json = new StringBuffer(); String line = null; try { BufferedReader reader = request.getReader(); while((line = reader.readLine()) != null) { json.append(line); } } catch(Exception e) { System.out.println(e.toString());

回答2:

spring 拦截器 HttpServletRequest request 中获取不到 session域可以么?~ 你这里的权限验证也是在 进入action方法之前执行的吧