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

Use js to simulate struts2 multi-action call example_javascript skills

WBOY
Release: 2016-05-16 16:47:41
Original
1078 people have browsed it

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.
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template