) Implement permission control in the crud of struts2 (2)

Source: Internet
Author: User
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...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.