Struts2 Action Method wildcard character

Source: Internet
Author: User

Struts.xml:

<?xml version= "1.0" encoding= "UTF-8"? ><! DOCTYPE struts Public "-//apache software foundation//dtd struts Configuration 2.3//en" "http://struts.apache.org/dtds/ Struts-2.3.dtd "><struts><!--override Struts2 Some constants default value--<constant name=" Struts.enable.DynamicMethodInvocation "value=" false "/> <constant name=" Struts.devmode "value=" true "/> &lt ; constant Name= "struts.action.extension" value= "Action,,do" ></constant> <constant name= " Struts.configuration.xml.reload "value=" true "></constant><package name=" Default "namespace="/hello/ xxx "extends=" Struts-default "><action name=" Test1 "><result>/index.jsp</result></action ></package><package name= "P1" extends= "Struts-default" ><action name= "test2" class= " Com.opensymphony.xwork2.ActionSupport "method=" execute "><result name=" Success "type=" Dispatcher ">/ Index.jsp</result></action><action name= "test3" class= "com.itheima.actions.ActionDemo1 "method=" dosomething "><result>/index.jsp</result></action><!--<action Name= "Testadd" class= "Com.itheima.actions.ActionDemo1" method= "Addmethod" ><result>/index.jsp</result ></action><action name= "Testupdate" class= "Com.itheima.actions.ActionDemo1" method= "UpdateMethod" > <result>/index.jsp</result></action>-<!--action Method wildcard--<!--convention is better than the configuration path:/http Localhost:8080/day24_03struts2_constant/customeraction_addcustomer.action Action class: Customeraction action method: AddCustomer Results turned to page: addcustomer.jsp--><action name= "*_*" class= "Com.itheima.actions". {1} "method=" {2} "><result>/{2}.jsp</result></action></package></struts>

Note Line tenth, value= "Action,,do" in the middle of the two comma, so that the configuration can be accessed at the time of the path to omit the later. Action

Customeraction.java:

Package Com.itheima.actions;import Com.opensymphony.xwork2.actionsupport;public Class Customeraction extends Actionsupport{public String Addcustomer () {System.out.println ("Addcustomer"); return SUCCESS;} Public String Delcustomer () {System.out.println ("Delcustomer"); return SUCCESS;} Public String UpdateCustomer () {System.out.println ("UpdateCustomer"); return SUCCESS;}}

  

Struts2 Action Method wildcard character

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.