Struts2使用14 -- 拦截器4 -- 自定义拦截器
来源:互联网 发布:苹果mac密码忘了怎么办 编辑:程序博客网 时间:2024/05/20 12:49
实现拦截器,主要有以下三种方法:
l 实现Interceptor接口
Interceptor接口有三个方法:
public interface Interceptor extends Serializable {
void destroy();
void init();
String intercept(ActionInvocation invocation) throws Exception;
}
l 继承AbstractInterceptor抽象类
AbstractInterceptor实现了Interceptor接口,但这个抽象类对“destroy”和“init”方法进行了重写,但在方法中没有执行任何操作。主要用于不需要执行其他初始化或清理动作。
l 继承MethodFilterInteceptor抽象类
MethodFilterInteceptor继承AbstractInterceptor类,主要用与对Action方法过滤的拦截器。有集合两个属性:includeMethods和excludeMethods,includeMethods表示:包含Action方法,作用是拦截器只对包含方法进行拦截,其他不进行拦截,可以配置多个,以逗号隔开。excludeMethods表示:不包含Action方法,作用是拦截器对不包含方法不进行拦截,其他进行拦截,可以配置多个,以逗号隔开。
注意:如果一个方法即在includeMethods又在excludeMethods属性中,includeMethods优先于excludeMethods。
- Struts2使用14 -- 拦截器4 -- 自定义拦截器
- struts2--使用自定义拦截器
- struts2 自定义拦截器
- Struts2自定义拦截器
- Struts2自定义拦截器
- struts2自定义拦截器
- Struts2自定义拦截器
- Struts2自定义拦截器
- Struts2自定义拦截器
- Struts2自定义拦截器
- struts2自定义拦截器
- Struts2---自定义拦截器
- struts2自定义拦截器
- struts2自定义拦截器
- Struts2自定义拦截器
- struts2自定义拦截器
- struts2自定义拦截器
- struts2自定义拦截器
- Oracle Flashback 技术总结
- 3G总机给予新希望
- Struts2使用13 -- 拦截器3 -- 内置拦截器
- php5.3改动
- 请高手指点
- Struts2使用14 -- 拦截器4 -- 自定义拦截器
- DHTML (JavaScript Dom 编程艺术)
- Struts2使用15 -- 拦截器5 -- 实例
- ssh例子
- 报错:"该连接已关闭"
- ActionScript登場
- Struts2使用16 -- 值栈与 OGNL 1 -- 概述
- VS2005 出现warning C4996: strcpy was declared deprecated
- 是