The Execute method is not necessarily executed when the action is executed
You can use method= to make the execution of the Wei Jian when you configure the action on the accessory.
Can also be specified dynamically in the URL address (dynamic method call MDI)
To illustrate this:
The former produces too much action
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 just one action, just enter the method name in the URL
<action name= "user" class= "com.b510.hongten.UserAction" >
<result>/user.jsp</result>
</action>
Called when we write this in the URL:
Http://localhost:1000/struts2_0500_actionMethod/user/user!add
Http://localhost:1000/struts2_0500_actionMethod/user/user!sub
So you can do it without a lot of action.
-------------------------------------------------------------------------------------------------
Useraction.java
Code:
Import Com.opensymphony.xwork2.ActionSupport;
public class Useraction extends Actionsupport {
Public String Add () {
return SUCCESS;
}
}
Structs2 DMI Dynamic Method invocation