惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Tailwind CSS Blog
人人都是产品经理
人人都是产品经理
博客园 - 叶小钗
大猫的无限游戏
大猫的无限游戏
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 【当耐特】
The Cloudflare Blog
博客园 - 聂微东
博客园 - 司徒正美
量子位
博客园 - 三生石上(FineUI控件)
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
G
Google Developers Blog
Apple Machine Learning Research
Apple Machine Learning Research
罗磊的独立博客
酷 壳 – CoolShell
酷 壳 – CoolShell
Y
Y Combinator Blog
S
SegmentFault 最新的问题
T
The Blog of Author Tim Ferriss
P
Proofpoint News Feed
Google DeepMind News
Google DeepMind News
Blog — PlanetScale
Blog — PlanetScale
有赞技术团队
有赞技术团队
A
About on SuperTechFans

博客园 - 殇

java设计模式基础之设计原则 java--callback GEF七天之第五天 java基础--特殊的String GEF七天之第四天 GEF七天之第三天 GEF七天之第二天 GEF七天之第一天 距离矢量路由算法(最短路Bellman-Ford实现)实现 网络编程--简单实现javaftp服务器 网络编程--ftp客户端的实现(c#版) c#套接字的实现 好东西大家分享: JAVA学习的一些重点 最基础的数据结构(转自程序员杂志) java面试算法题(经典) (转)JSP上传视频后自动转成flv的核心JAVA方法 2008年1月编程语言排名(转) 利用Render方法生成静态页 (转)实现struts2的CRUD中的权限控制(一)
(转)实现struts2的CRUD中的权限控制(二)
· 2008-01-28 · via 博客园 - 殇

 在《 实现struts2的CRUD中的权限控制》这篇文章中,我提了一个问题,就是说在自己实现了权限拦截器后,每个action都要配置拦截器后才可以在调用他后进行权限检查,今天看了一下资料,可以设定默认的拦截器,在没有显示设定拦截器时就会使用默认拦截器,达到该目的,以后该package中的方法都会使用默认的“权限拦截器”,示例配置文件如下:

<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>

      上面得配置中大家可以看到我们使用了全局result也是基于要解决像每个action都要配置拦截器一样的重复问题,其实全局result也就是为了减少重复,回过头来看,默认拦截器是不是也可以全局拦截器呢,有这样的味道,呵呵...