Struts2---dynamic method invocation

Source: Internet
Author: User

<?XML version= "1.0" encoding= "UTF-8"?><!DOCTYPE struts Public "-//apache software foundation//dtd struts Configuration 2.0//en" "Http://struts.apache. Org/dtds/struts-2.3.dtd "><Struts>< Packagename= "Default"namespace="/"extends= "Struts-default">              <constantname= "Struts.enable.DynamicMethodInvocation"value= "true"></constant><!--specify the methods that can be used -<!--to reduce the definition of an action, you often define multiple methods in an action to respond to different requests, -<!--search for a method that specifies a method, based on a different situation, to find the result view corresponding to the return value -<!--1. Called by wildcard, _ represents the delimiter, * represents the match (the name value matching the result results) calls the Delete method, such as URL = "Localhost:8080/hellostruts2/delete_struts.action "<action name=" *_struts "class=" com.dunn.action.HelloStruts2 "method=" {1} "> <resul T >/result.jsp</result> <result name= "delete" >/{1}.jsp</result> <result na Me= "Hello" >/{1}.jsp</result> </action> -                      <!--2. Call by method name, specify the value of constant tag element struts.enable.DynamicMethodInvocation to True, call the Delete method, such as URL = "localhost:8080/             Hellostruts2/exestruts!delete.action "<action name=" exestruts "class=" Com.dunn.action.HelloStruts2 ">             <result >/result.jsp</result> <result name= "Delete" >/delete.jsp</result> <result name= "Hello" >/hello.jsp</result> </action> -                      <!--3. By Action,name call, the URL of the call to the Delete method is, url= "localhost:8080/hellostruts2/deletestruts.action" <action name= "          Hellostruts "class=" com.dunn.action.HelloStruts2 "method=" Hello "> <result >/result.jsp</result>             </action> <action name= "deletestruts" class= "com.dunn.action.HelloStruts2" method= "Delete" > <result >/result.jsp</result> </action> - </ Package> </Struts>
View Code

Struts2---dynamic method invocation

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.