Struts_ActionWildcard _ wildcard configuration, struts2action wildcard

Source: Internet
Author: User

Struts_ActionWildcard _ wildcard configuration, struts2action wildcard

Use wildcards to minimize configurations

However, we must abide by the principle of "configuration as agreed ".

Struts2.xml

1 <? Xml version = "1.0" encoding = "UTF-8"?> 2 <! DOCTYPE struts PUBLIC 3 "-// Apache Software Foundation // DTD Struts Configuration 2.3 // EN" 4 "http://struts.apache.org/dtds/struts-2.3.dtd"> 5 6 <struts> 7 <constant name = "struts. configuration. xml. reload "value =" true "/> 8 <constant name =" struts. enable. dynamicMethodInvocation "value =" true "/> 9 10 <! -- Namespace must start with "/" --> 11 <package name = "actions" namespace = "/actions" extends = "struts-default"> 12 <action name = "Student_add" class = "com. bjsxt. struts2.action. testAction "method =" test "> 13 <result>/test. jsp </result> 14 </action> 15 16 <action name = "Student *" class = "com. bjsxt. struts2.action. studentAction "method =" {1} "> 17 <result>/student {1} _ success. jsp </result> 18 </action> 19 20 <action name = "* _ *" class = "com. bjsxt. struts2.action. {1} Action "method =" {2} "> 21 <result>/{1 }_{ 2} _ success. jsp </result> 22 </action> 23 </package> 24 25 </struts>

StudentAction

 1 package com.bjsxt.struts2.action; 2  3 import com.opensymphony.xwork2.ActionSupport; 4  5 public class StudentAction extends ActionSupport{ 6  7     private static final long serialVersionUID = -8074753294134724983L; 8      9     public String delete(){10         return SUCCESS;11     }12     13     public String add(){14         return SUCCESS;15     }16 17 }

CourseAction

 1 package com.bjsxt.struts2.action; 2  3 import com.opensymphony.xwork2.ActionSupport; 4  5 public class CourseAction extends ActionSupport{ 6  7     private static final long serialVersionUID = -602409660355584918L; 8  9     public String add(){10         return SUCCESS;11     }12     13     public String delete(){14         return SUCCESS;15     }16 }
View Code

TeacherAction

 1 package com.bjsxt.struts2.action; 2  3 import com.opensymphony.xwork2.ActionSupport; 4  5 public class TeacherAction extends ActionSupport{ 6      7     private static final long serialVersionUID = -7951798648480925065L; 8  9     public String add(){10         return SUCCESS;11     }12     13     public String delete(){14         return SUCCESS;15     }16     17 }
View Code

TestAction

package com.bjsxt.struts2.action;import com.opensymphony.xwork2.ActionSupport;public class TestAction extends ActionSupport{    private static final long serialVersionUID = -8074753294134724983L;        public String test(){        return SUCCESS;    }}

Link: http://pan.baidu.com/s/1miDgviS password: m24y

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.