The concept Description: dynamic invocation method that is written in the same Action on demand in multiple methods to achieve, and in accordance with the test method name! Or wildcard (recommended) call on the specified method, dynamic invocation method is in line with our programming Thinking can circumvent the limitations of one Action corresponding to one method.
Common dynamic method invocation ( the three ways of Dannii-Struts2 dynamic method invocation ):
① Specify the method attribute of the action tag
② Access the Action + of the address bar! The name of the method to be called
③ Combine the name attribute and method attribute of the action tag to achieve
( A) action +! Method name
① Find struts2-core-xxx/org.apache.struts2/default.properties in the jar library, retrieve struts.enable.DynamicMethodInvocation
② Add configuration in struts2.xml
(B) name + method( (Recommended)
① Add _* to the name attribute value of the action tag, and then assign the method attribute value (starting from 1 by default)
② Add an underscore (_, a common separator for dynamic method calls) and specify execution after the accessed Action Method name
Complete the method dynamic call in Struts2
Guess you like
Origin blog.csdn.net/qq_44965393/article/details/111933594
Recommended
Ranking