Struts2 DMI cannot run

Source: Internet
Author: User

When learning dynamic method calls, the written link is <a href = "User/user! List "> Add students </a>

However, when you click the link, the following error message is displayed:

There is no Action mapped for namespace [/user] and action name [user! Add] associated with context path [/struts2_050_actionmethod]

 

After checking the document, we can see that struts2 can choose enable and disable for DMI for two reasons: 1) DMI may cause security problems; 2) DMI and wildcard method functions overlap.

However, by default, DMI is enable.

After carefully reading my configuration file, I found that when I copied other files, I copied such a sentence.

<Constant name = "struts. Enable. dynamicmethodinvocation" value = "false"/>

In this case, DMI is set to disable.

 

Delete this sentence, or change the value to "true" to get the expected result.

Add in struts. xml

<Constant name = "struts. Enable. dynamicmethodinvocation" value = "true"/>
Enable dynamic method call.
We recommend that you use wildcards to call dynamic methods. Do not use actionname! Methodname
.

 

Dynamic method calls in versions earlier than struts2 are enabled by default, but 2.3.15 is disabled by default.

Struts2 DMI cannot run

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.