There is no Action mapped for action name mylogin! Regist error cause, mappedmylogin

Source: Internet
Author: User

There is no Action mapped for action name mylogin! Regist error cause, mappedmylogin

Disclaimer: this blog is an original blog and cannot be reproduced without permission! If you can see it in other places, it is recommended to take a look at csdn (the original link address for the http://blog.csdn.net/bettarwang/article/details/39650937), after all, in the csdn to see the code and questions, discussion is more convenient.

As we all know, you can use DMI (Dynamic Method Invocation, Dynamic Method call) to perform an Action that corresponds to multiple form actions. When trying to log on to and register two form actions tonight, "There is no Action mapped for action name mylogin! The regist error is checked many times. The struts. xml and JSP files are not correct. src can also be compiled, but the above error is always displayed when you click Register.

After more than half an hour of hard work, I finally found the cause. I didn't open the dynamic method call in the configuration item, because Struts2 does not allow the dynamic method call by default. If you find the cause, there are two solutions:

The first is to add the upper and lower sentences in struts. xml:

<Constant name = "struts. enable. DynamicMethodInvocation" value = "true"/>

The second is to create a properties file under src, and add struts. enable. DynamicMethodInvocation = true.

I personally recommend the first method, because the second method is actually reserved to ensure backward compatibility, but the new configuration method is to use xml files for configuration.


There is no Action mapped for namespace/and action name login. It's not done in a day. Please help,

You have configured the web. xml in the options ah, not to add a Struts2-Spring-plugin-2.1.8.1.jar this plug-in can be ah ·~~~ Configure the web. xml file.
 
Form submission and Action in Struts2 framework

The form action should be set to "UserLogin. action ", the interceptor is intercepted according to the Action name, therefore, the package name cannot be added here, you should write in struts. the name of the Action class configured in xml. action.

The error message indicates that the Action class cannot be found.
There is no Action mapped for namespace/and action name XXXXX.-[unknown location]

In the configuration file, you need to configure this Action class. First, take a name for it, which is generally called "UserLogin. action, and then specify a specific class for it, that is, tell Struts that your Action is handled by that class. For example:
<! -- Log on to action -->
<Action name = "Login" class = "struts2.LoginAction">
<Result name = "input"> index. jsp </result>
<Result name = "success"> success. jsp </result>
</Action>
This configuration means that the Action name is Login, which is handled by the LoginAction class under the struts2 package.

It is recommended that you go to the Struts 2 practice book to explain it clearly and easily.

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.