Example of using js to simulate struts2's multiple action calls

  • 2020-03-30 02:59:01
  • OfStack

Recently, I have fixed several bug of dynamic method call failure after upgrading from struts2.1 to 2.3.

But one limitation of my original method is that the action written at submit doesn't work, even if dynamic method invocation is started (I think it's a bug in struts2.3), so to improve this functionality, I'll add a js method here.

In < S :submit value=" submit "onclick="return submitAction(' so-and-so action')" /> , add the onclick method, and then write in js:

function submitAction(actionName){ 
document.form the name.action = actionName+".action"; 
return true; 

Or is it < S :submit value=" submit "onclick="submitAction(' so-and-so action')" /> , notice that the return word is missing, and then write in js:
function submitAction(actionName) { 
document.form the name.action = actionName+".action"; 
document.form the name.submit(); 

Now that struts2's dynamic method calls are almost complete, comments are welcome.

Related articles: