Recently, I fixed a few bugs that caused dynamic method calls to fail after upgrading Struts 2.1 to 2.3. I have deep insights into this.
But my original method has a limitation, that is, the action written in submit does not work. It works, even if dynamic method calling is enabled (I think it is a bug in struts2.3), so in order to improve this function, here I will talk about another method using js.
In , add the onclick method, and then write in js:
function submitAction(actionName){
name.action of document.form = actionName ".action";
return true;
}
or
, pay attention to the lack of a return word, and then write in js:
function submitAction(actionName) {
document.form name.action = actionName ".action";
document.form name.submit();
}
Now the dynamic method calling of struts2 is basically complete. Comments and additions are welcome.