Recently repaired a few struts2.1 upgrade to 2.3 after the dynamic method call failed bug, deep feeling,
But my original method has a limitation, that is, the action written in submit does not work, even if the launch of dynamic method calls also not (I think it should be a bug struts2.3), so in order to improve this function, here I say a JS method.
In <s:submit value= "Submit" onclick= "return submitaction (' So-and-so action ')"/>, add the OnClick method, and then write in JS:
Copy Code code as follows:
function Submitaction (actionname) {
Document.form's name.action = actionname+ ". Action";
return true;
}
Or is <s:submit value= "Submit" onclick= "submitaction (' So-and-so action ')"/>, pay attention to one less return word, and then write in JS:
Copy Code code as follows:
function Submitaction (actionname) {
Document.form's name.action = actionname+ ". Action";
Document.form of Name.submit ();
}
Now Struts2 dynamic method calls are basically perfect, welcome comments to Add.