Structs2 DMI dynamic method call, structs2dmi

Source: Internet
Author: User

Structs2 DMI dynamic method call, structs2dmi

The execute method is not required when the Action is executed.

You can use method = to set the method to be executed when configuring the Action in the accessory weizi'an,

You can also specify the dynamic method in the url (dynamic method call MDI)

Note:

The former generates too many actions.

For example, <action name = "user" class = "com. b510.hongten. UserAction" method = "add">

<Result>/user. jsp </result>

</Action>

<Action neme = "user" class = "com. b510.hongten. UserAction" method = "sub">

<Result>/user. jsp </result>

</Action>

...

</Action>

The latter can do this with only one action, just enter the method name in the url.

<Action name = "user" class = "com. b510.hongten. UserAction">

<Result>/user. jsp </result>

</Action>

During the call, we write the following in the url:

Http: // localhost: 1000/struts2_0500_actionMethod/user! Add

Http: // localhost: 1000/struts2_0500_actionMethod/user! Sub

In this way, a lot of actions are not needed.

Bytes -------------------------------------------------------------------------------------------------

UserAction. java

Code:

Import com. opensymphony. xwork2.ActionSupport;

Public class UserAction extends ActionSupport {
Public String add (){
Return SUCCESS;
}
}

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.