1.首先在struts.xml配置中开启
<constant name="struts.enable.DynamicMethodInvocation" value="true"/>
2授权使用
<allowed-methods>[MethodName]</allowed-methods>
3.在Action类中定义此Method,签名与默认execute()方法保持一致
4..修改Action的属性
function xxx()
{
// 获取页面的第一个表单
targetForm = document.forms[0];
// 动态修改表单的action属性
targetForm.action = "login!regist";
}
格式 : [ActionName]!{Method]
5.控件中action指定函数
例:
<s:submit key="注册" onclick="regist();"/>
这样Aciton将获得多个方法能力。