Structs2 DMI dynamic method call
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:
/User. jsp
/User. jsp
...
The latter can do this with only one action, just enter the method name in the url.
/User. jsp
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;
}
}