Regardless of the database has the data page always jump out "the user does not exist", namely the controller corresponding to the teacher in==null
@ Controller
@ RequestMapping ("/the teacher ")
Public class ReUserInfoController {
The @autowired
Private ReUserInfoService ReUserInfoService;
/* *
* teacher login
* @ param copyUserInfo
* @ return
*/
//scanning is the action of the JSP page parameters above
@ RequestMapping ("/teacher_login ")
Public String teacher_login (CopyUserInfo CopyUserInfo, it request, Model Model) {
String MSG="";
//according to login account to judge whether the user is
CopyUserInfo. The teacher=reUserInfoService selectTeacherByRID (CopyUserInfo getTeacher_RID ());
If the teacher (==null) {
MSG="the user does not exist!" ;
} else {
If (the teacher getTeacher_Pass (.) the equals (copyUserInfo. GetTeacher_Pass ())) {
/* the user information into the session */
Request. GetSession (). The setAttribute (" the userInfo ", the teacher);
//get sessionid
String sessionId=request. GetSession (). The getId ();
Model. The addAttribute (" sessionId "sessionId);
//into the main interface
Return "/teacher_main";
} else {
MSG="password error!" ;
}
}
Model. The addAttribute (" MSG ", MSG);
//returns the page, login is address
Return "/login";
}
}
Idea below seems to be able to successfully find the data
CodePudding user response:
Action if no write wrong, in the name of the form controls and entity class attribute name if is consistent, meng, don't know what wrongAttached to the JSP interface
CodePudding user response:
On your teacher_ID code is equal to null, you can test the id look output, suggest the parameters of the receiving written as an Integer id that receive the front desk to get the id of the value directlyCodePudding user response:
You this IDEA console log shows you teacher_RID is 10000 and can check the data, but if (the teacher==null) is true, that the problem is the query results are not mapped back to the controller layer CopyUserInfo, problems should be out in your persistence layer, the mapping problem, you should debug is that part of the codeCodePudding user response:
First of all, print you receive teacher_RID, have a look at whether or not received, if it is null, you can use the request. GetParamter (); Available, but can be by annotation @ RequestParam (" ") annotation,If the received there is value in teacher_RID, and found out the data, but judgment is null, then take a look at your mapper file the return type of statement, whether CopyUserInfo, verify the return type of his statement is correct one or two also said not clearly, because I don't know whether you are using annotations or XML file, if it is the return type of the XML file you is to configure an alias or resultmap, or is the package path, as long as you can find out data, receives the value, it must be your mapper file statement the return type of problem
CodePudding user response: