Implementation of permission control in crud of struts2 Article In, I raised a question, that is, after implementing the permission interceptor, each action must be configured with the interceptor before it can be called for permission check. Today I read the information, you can set the default Interceptor. If no interceptor is displayed, the default interceptor is used. In the future, all methods in the package will use the default "permission interceptor ", the sample configuration file is as follows:
< Package Name = "Admin" Extends = "Struts-Default" Namespace = "/Admin" >
< Interceptors >
< Interceptor Name = "Auth"
Class = "Com. waimai. utils. authorizationinterceptor" />
</ Interceptors >
< Default-interceptor-ref Name = "Auth" />
< Global-results >
< Result Name = "Login" Type = "Redirect" >
/Security/login. jsp
</ Result >
</ Global-results >
< Action Name = "List" Class = "Com. waimai. Web. caitypeaction"
Method = "List" >
< Result > Listcaitype. jsp </ Result >
</ Action >
< Action Name = "Edit" Class = "Com. waimai. Web. caitypeaction"
Method = "LOAD" >
< Result > Editcaitype. jsp </ Result >
</ Action >
< Action Name = "Store" Class = "Com. waimai. Web. caitypeaction"
Method = "Store" >
< Result Name = "Input" Type = "Dispatcher" >
Editcaitype. jsp
</ Result >
< Result Type = "Redirect" > List. Action </ Result >
</ Action >
< Action Name = "Remove" Class = "Com. waimai. Web. caitypeaction"
Method = "Remove" >
< Result Type = "Redirect" > List. Action </ Result >
</ Action >
</ Package >
In the above configuration, we can see that the global result is also based on the problem that we need to configure the interceptor for every action. In fact, the global result is to reduce duplication, does the default interceptor support global interceptors? It tastes like this...