Example of simulating multiple actions in struts2 using js

Source: Internet
Author: User

I recently fixed several bugs that failed to call DYNAMIC METHODS After struts2.1 was upgraded to 2.3,

However, there is a limitation in my original method, that is, the action written in the submit does not work, even if a dynamic method call is started (I think it should be a bug of struts2.3 ), so to improve this function, I will talk about the js method here.

In <s: submit value = "submit" onclick = "return submitAction ('xx Action')"/>, add the onclick method, and then write in js:
Copy codeThe Code is as follows:
Function submitAction (actionName ){
Name. action = actionName + ". action" of document. form ";
Return true;
}

Or <s: submit value = "submit" onclick = "submitAction ('xx Action')"/>. Note that a return word is missing, and then write in js:
Copy codeThe Code is as follows:
Function submitAction (actionName ){
Name. action = actionName + ". action" of document. form ";
Name. submit ();
}

Now the dynamic method calls of struts2 are basically complete. Please comment and Add.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.