search

Home  >  Q&A  >  body text

javascript - When taking the value of session in the function method, why does js fail and prompt that the button cannot be found?

var code = request.getSession.getAttribute("code");

I added this sentence to the js method. I want to get the code sent from the background, and then the js introduced will be invalid. After unchecking it, it can run normally.
Please give me an answer.

public String mailcode(String mail,HttpServletRequest request) throws Exception{
        RegisterPojo registerPojo = registerService.findBymail(mail);
        if(registerPojo == null){
            //生成四位随机数字
            Random random = new Random();
            int code = random.nextInt(9999-1000+1)+100;
            String mailcode = String.valueOf(code);
            Main.main(mail, mailcode);
            HttpSession session = request.getSession();
            session.setAttribute("code", mailcode);
             return mailcode;
        }
            return "";
            
    }
为情所困为情所困2794 days ago562

reply all(1)I'll reply

  • 为情所困

    为情所困2017-05-19 10:36:01

    Need to see your error message

    reply
    0
  • Cancelreply