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;
}
}