struts1.1拦截器
来源:互联网 发布:十元夺宝源码 编辑:程序博客网 时间:2024/05/21 21:44
Usage Notes
To use SAIF, you must configure it as a Struts plugin, configure the interceptor config file, and write any interceptors you need.
Struts Plug-In Configuration
SAIF needs to be configured as a plugin in the Struts configuration file. In the plug-in configuration, the location of the interceptor configuration file needs to be defined. It should look something like this:
<plug-in className="net.sf.struts.saif.SAIFPlugin">
<set-property property="interceptor-config" value="/WEB-INF/interceptor-config.xml" />
</plug-in>
Interceptor Configuration
All interceptors are defined in interceptor-config.xml (of course it could have any name). This file contains the interceptor definitions and how they should be applied. There are two ways to declare interceptors for Struts Actions: globally and by Action. When the Action is requested, first any global interceptors will be applied, then Action-specific interceptors.
The following interceptors are included in SAIF:
This is an example of an interceptor configuration file:
<interceptor-config>
<interceptor name="componentInterceptor" type="net.sf.struts.saif.ComponentInterceptor"/>
<interceptor name="testInterceptor" type="net.sf.struts.saif.TestInterceptor"/>
<default-interceptors>
<interceptor name="componentInterceptor"/>
</default-interceptors>
<action type="org.apache.struts.webapp.example.EditRegistrationAction">
<interceptor name="testInterceptor"/>
</action>
</interceptor-config>
Interceptor Implementation
Interceptors can perform actions before and after a Struts Action is called. To write an interceptor, simple implement the net.sf.struts.saif.ActionInterceptor interface and implement the beforeAction() and afterAction() methods.
This is an example of an interceptor implementation:
public class TestInterceptor implements ActionInterceptor{public void beforeAction(Action action, ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response){log.debug("beforeAction called");}public void afterAction(Action action, ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response){log.debug("afterAction called");}private Log log = LogFactory.getLog(TestInterceptor.class);}
- struts1.1拦截器
- struts1的拦截器1_1
- struts1的拦截器1_2
- struts1的拦截器2
- struts1的拦截器(1.1)
- 在struts1.2中使用拦截器
- struts1的拦截器(1.2)
- struts1的拦截器,一个简单的示范
- 在Struts1.x中使用net.sf.struts.saif.SAIFSpringPlugin配置Interceptor(拦截器)
- Stutus2拦截器(1)
- 自定义拦截器1
- struts1.1到struts1.2.9的移植
- struts1学习之--1、struts1相关理论
- Struts1.1控制模型
- Struts1.1 介绍
- Struts1.1 介绍
- 了解Struts1.1
- 了解Struts1.1
- sybase 系统表集合
- 为什么要使用接口编程
- PerlMagick在Windows2000下安装的问题
- Windows API 函数学习(10)---定时器,静态控件示例
- 关于util包中的LinkedList类的一个小问题
- struts1.1拦截器
- 多线程同步机制摘要
- mysql字符串函数
- 虚拟linux挂载window中的文件
- 关于util包中的ArrayList类的一个小问题
- java各资源下载地址!
- 系统莫名的挂了。。昨天刚刚搞定。。
- double.c中遇到的问题!!!
- 如何实施集团企业的ERP财务模块