账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    后台只能接收get请求,使用post传值接收的数据为null,这是咋地了?
    52
    0

    问题描述

    后台只能接收get请求,使用post传值接收的数据为null

    问题出现的环境背景及自己尝试过哪些方法

    打断点看了一下post请求传过来的值为null
    使用postman测试的,本以为是测试软件的问题,之后自己写了一个form表单测试,结果相同,
    使用post传值不能接收到数据

    相关代码

    // 请把代码文本粘贴到下方(请勿用图片代替代码)

    @RequestMapping(value = "login.do", method = RequestMethod.GET)
    @ResponseBody
    public ServerResponse<User> login(String username,String password, HttpSession session){
        ServerResponse<User> response = iUserService.login(username,password);
        if(response.isSuccess()){
            session.setAttribute(Const.CURRENT_USER,response.getData());
        }
    
        return response;
    }
    

    你期待的结果是什么?实际看到的错误信息又是什么?

    username 和 password 应该可以接收到前端传过来的值
    但是实际上并没有接收到,值为null

    1
    打赏
    收藏
    点击回答
        全部回答
    • 0
    • 过期爱人 普通会员 1楼
      502 Bad Gateway

      502 Bad Gateway


      nginx
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部