Mapping. getinputforward () and mapping. getinput

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.