struts2——自定义拦截器!!!
2010-09-28 16:35
357 查看
import com.opensymphony.xwork2.ActionInvocation; import com.opensymphony.xwork2.interceptor.Interceptor; public class MyInterceptor implements Interceptor { public String intercept(ActionInvocation invocation) throws Exception { long start = System.currentTimeMillis(); String str = invocation.invoke(); long end = System.currentTimeMillis(); System.out.println("action time:" + (end - start)); return str; } public void destroy() { } public void init() { } }
<struts> <package name="test" namespace="/" extends="struts-default"> <interceptors> <interceptor name="myinterceptor" class="test.MyInterceptor"/> </interceptors> <action name="test" class="test.Test"> <result name="success">/hello.jsp</result> <interceptor-ref name="myinterceptor"/> <interceptor-ref name="defaultStack"/> </action> </package> </struts>
相关文章推荐
- Struts2自定义拦截器
- struts2 自定义拦截器
- struts2自定义拦截器
- Struts2的异常处理机制、自定义拦截器
- Struts2 自定义拦截器(方法拦截器)
- 框架学习之Struts2 第五节 自定义拦截器
- struts2自定义拦截器
- Struts2自定义拦截器——完整实例代码
- Struts2自定义拦截器—Session超时的处理
- struts2声明式异常处理,友好的错误界面,自定义异常拦截器,
- .Java程序员从笨鸟到菜鸟之(四十七)细谈struts2(九)内置拦截器和自定义拦截器详解(附源码) 分类: 学习专区 框架Struts2 Java程序员从笨鸟到菜鸟 2012-05-08 12:
- struts2自定义一个拦截器
- Struts2的自定义拦截器
- Struts2自定义拦截器
- SSH-Struts2简单的自定义拦截器MethodFilterInterceptor
- Struts2第七篇【介绍拦截器、自定义拦截器、执行流程、应用】
- struts2自定义拦截器
- Struts2笔记——自定义拦截器
- struts2自定义拦截器
- struts2自定义拦截器与cookie整合实现用户免重复登入