Use the intercept method of the interceptor of struts2
Invocation. getinvocationcontext ()
Obtain the request parameters submitted by the browser.
Obtain the parameters submitted by the user in the action.
1. directly set the attribute with the same parameter name in the action. Set get and set. Struts is automatically injected.
2. domain model receives parameters. If the parameter is an attribute of a model. You can directly include a model attribute variable in the action. The model object is automatically injected according to the parameters.
You must also write the get set method.
Note the parameter transmission method. However, the number of parameters is not necessarily the same as the number of model attributes. Therefore, DTO is used.
3. Use modeldriven
Action Implementation interface modeldriven
Take model as the attribute of action, which is similar to the second type. However, the parameter passing format is similar to the first one.
4 actioncontext. getcontext (). getparameters ();