Struts2 学习笔记——struts.xml文件之拦截器的配置
来源:互联网 发布:智能网络摄像机哪个好 编辑:程序博客网 时间:2024/05/02 04:40
拦截器其实就是AOP的编程思想。拦截器允许在Action处理之前或者Action处理之后,插入自己的代码,来完成特定的功能。
我们可以在struts.xml文件中使用<interceptors>元素来配置拦截器或者拦截器栈信息。
如下片段:
<!-- 下面定义拦截器部分 -->
<interceptors>
<!--定义验证权限的拦截器 -->
<interceptor name="authority"class="org.struts2.samples1.AuthorityInterceptor"></interceptor>
<!-- 下面定义拦截器栈 -->
<interceptor-stack name="simpleStack">
<interceptor-ref name="params"></interceptor-ref>
<interceptor-ref name="defaultStack"></interceptor-ref>
</interceptor-stack>
</interceptors>
下面是在Action中引用拦截器片段:
<action name="login" class="org.struts2.samples.LoginAction">
<interceptor-ref name="authority"></interceptor-ref>
<result>/main.jsp</result>
</action>
引用拦截器栈的方式与引用拦截器相同。
- Struts2 学习笔记——struts.xml文件之拦截器的配置
- Struts2 学习笔记——struts.xml文件之Bean的配置
- J2EE系列之Struts2学习笔记(九)--使用通配符配置struts.xml文件
- struts2 学习笔记之 struts.xml 配置解析
- Struts2学习笔记(三)struts.xml文件的常用配置及注意事项
- Struts2学习笔记之与struts.xml配置和Action有关的属性
- Struts2学习笔记之与struts.xml配置和Action有关的属性
- Struts2 Chapter2 struts.xml文件的配置
- 《研磨struts2》之struts.xml的配置
- Struts2笔记——struts.xml配置详解
- Struts2配置struts.xml文件
- struts2 入门(笔记二):struts配置相关与拦截器
- struts2学习(13)——拦截器的配置
- Struts2国际化、拦截器配置以及使用struts上传文件
- Struts2学习笔记之struts.xml配置常量和Action处理流程
- Struts2学习笔记之struts.xml配置常量和Action处理流程
- J2EE系列之Struts2学习笔记(七)--struts.xml配置
- J2EE系列之Struts2学习笔记(八)--struts.xml分模块配置
- Building Fire Stations 39届亚洲赛牡丹江站B题
- nonatomic 表示原子
- IOS获取设备类型 (更新添加iPhone6 & iPhone6 Plus)
- oracle强化练习之分组函数
- java获取工程目录下文件
- Struts2 学习笔记——struts.xml文件之拦截器的配置
- 第一个C语言程序
- DP题目列表,再续中。。。
- 虚函数在C++中用的作用是什么? 为什么要用到虚函数?
- 获取指定目录下的文件
- [Objective-C]关联(objc_setAssociatedObject、objc_getAssociatedObject、objc_removeAssociatedObjects)
- 设计模式之---装饰者模式
- Opencv的奇葩问题
- android tabhost的用法