The strange reason is that there is no error prompt when the login fails. This problem has plagued N for a long time.
After carefully reading the page, we found that the page jumps when the login fails to be processed.CodeMapping. getinputforward ();
After the breakpoint tracing is completed
Mapping. getinputforward (); what is it ?! Baidu and this is
Obtain the address corresponding to the input value in the action.
<Action Path = "/test"
Type = "org. Apache. Struts. webapp. example. testaction"
Name = "testform"
Scope = "request"
Input = "testinput">
<Forward name = "testinput" Path = "/testinput. jsp"/>
</Action>
Getinputforward (); obtains testinput in input in action. testinput is used to find the path/testinput. jsp corresponding to this alias in forward.
Mapping. getinput () obtains the testinput string in input of action.
Everything is clear here.
Why is there no error message when mapping. getinputforward (); is used?
Configure... run... OK
Loginaction code
Public actionforward login (actionmapping mapping, actionform form,
Httpservletrequest request, httpservletresponse response ){
Memloginform = (memloginform) form;
Memdao service = new memdaoimpl ();
Actionforward forward = NULL;
Actionmessages msgs = new actionmessages ();
Try {
Member mem = service. memlogin (memloginform. getloginname (), memloginform. getloginpwd ());
If (MEM! = NULL ){
Request. getsession (). setattribute ("member", Mem );
Forward = new actionforward ("/mer. do? Method = browseindexmer ");
} Else {
// Equivalent statement
// Forward = new actionforward ("/mer. do? Method = browseindexmer ");
Forward = mapping. getinputforward () ;
Msgs. Add ("loginerror", new actionmessage (constants. admin_loginerror_key ));
Saveerrors (request, MSGs );
}
} Catch (exception ex ){
Logger.info ("An error occurred while executing the login method in the loginaction class: \ n ");
Ex. printstacktrace ();
}
Return forward;
}
Reproduced from: http://www.tiansky.net: 8892/dbbbs/viewthread. jsp? Tid = 236 & extra = Page % 3d1