When I was working on a small program, I found that the session was invalid. Finally, Baidu’s small program had a problem with the session and learned that the small program requested a session at a time. In this case, when we involved login operations, there would be problems, at least not so convenient, and finally got The solution, come up to share a wave of
java:
①: in app.js
②: In the js that clicks to send the verification code request :
write the sessionid into app.js
③: When we make a request for verification code judgment:
Then we can get the session normally,
For example, during the login operation, click login, send a request, return a json data (sessionid in the json data), write the sessionid into app.js,,,, when we need to use this session operation, we Just call this sessionid, write header: header in the header of the request, and then the backend can operate through getSession().getAttribute