About the problem of DMI (dynamic call) error in Struts2


Prior to Struts2, dynamic method invocation was turned on by default. Unexpectedly, versions 2.3.15 and later were turned off by default.

Therefore need to enable, edit the struts.xml file, add or modify the following information:

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

Inquiring many results on the Internet is to add this sentence code.

Reference: https://www.cnblogs.com/6502ck/p/3984063.html

 

 

But I found in the use process that in the latest version, this is still inaccessible, and I need to add the following in the first child element of the <package element (this is very important, which must be added to the first child element of apkkage)

< package name = "user" namespace = "/ user" extends = "struts-default" > 
    <!- Use DMI to configure the allowed methods- > 
    < global-allowed-methods > add </ global-allowed-methods > 

    <! - to access:! / user / user add user calls the add method of action in the dynamic method calls, also known as DMI -> 
    
    < action name = "user" class = "com.actionmethod. CustomActionMethod " > 
        < result > /userAdd.jsp </ result > 
    </action>
</package>

Reference: https://blog.csdn.net/Liu10010/article/details/72579848

 

Guess you like

Origin www.cnblogs.com/heyunxu/p/12746270.html