Strust is equivalent to an empty container, and the built-in interceptor completes most of the operations on the framework. The struts2 interceptor is pluggable. To use an interceptor, you only need to apply it to the configuration file. If you do not need it, cancel it in the configuration file. Configure the interceptor Syntax: interceptor-stackname
Strust is equivalent to an empty container, and the built-in interceptor completes most of the operations on the framework. The struts2 interceptor is pluggable. To use an interceptor, you only need to apply it to the configuration file. If you do not need it, cancel it in the configuration file. Configure the interceptor Syntax: interceptor-stack name =
Strust is equivalent to an empty container, and the built-in interceptor completes most of the operations on the framework. The struts2 interceptor is pluggable. To use an interceptor, you only need to apply it to the configuration file. If you do not need it, cancel it in the configuration file.
Configure the interceptor Syntax:
......
When the interceptor parameter is specified, either it is defined or used in the struts. xml file.
Dynamic Parameters
If different parameter values are specified for the same parameter at two times, the parameter values specified when the interceptor is used are used.
Strust2 itself has a default interceptor stack. As long as the package of action inherits from struts-default, the interceptor stack is used for action by default. However, if a custom interceptor is used in an action, the default interceptor does not take effect unless it is declared. Only one default interceptor can be specified for each package.
When you implement your own interceptor class and call the intercept (ActionInvocation invocation) method, if a string is directly returned, the system will jump to the actual view corresponding to the logical view, instead of calling the intercepted action. The ActionInvocation parameter contains the reference of the intercepted Action. You can call
Invocation.invoke(); actionactionactionaction(), or the action.exe cute () method.
When using an interceptor to perform a user permission check, it is usually done by tracking HTTPSession and accessing the attributes in the session through ActionContext. Similar code is as follows:
Map session = ActionContext. getContext (). getSession ();
String userId = session. get ("user ");