Home  >  Article  >  Web Front-end  >  Use js to simulate struts2 multi-action call example_javascript skills

Use js to simulate struts2 multi-action call example_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:47:411057browse

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:

Copy code The code is as follows:

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:
Copy the code The code is as follows:

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.
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn