其实很简单,我们只看一下如何配置即可:
<struts>
<constant name="struts.devMode" value="true"></constant>
<package name="day2" namespace="/" extends="struts-default">
<!-- 演示动态方法调用 之参数占位符动态方法调用-->
<action name="TestAction_*" class="action.TestAction" method="{1}">
<result name="success">/success.jsp</result>
</action>
</package>
</struts>
在action中书写你所需要的方法:
public class TestAction extends ActionSupport {
public String update() throws Exception {
System.out.println("update方法执行了");
return SUCCESS;
}
public String add() throws Exception {
System.out.println("add方法执行了");
return SUCCESS;
}
public String delete() throws Exception {
System.out.println("delete方法执行了");
return SUCCESS;
}
}