自定义拦截器
来源:互联网 发布:js调用另一个js的函数 编辑:程序博客网 时间:2024/06/03 13:56
自定义拦截器,class类要继承AbstractInterceptor,Struts2中的拦截器都是继承它,实现intercept方法:
package com.interceptor;
import com.opensymphony.xwork2.ActionInvocation;import com.opensymphony.xwork2.interceptor.AbstractInterceptor; public class MyInterceptor extends AbstractInterceptor{ @Override public String intercept(ActionInvocation invocation) throws Exception { System.out.println("before"); String result = invocation.invoke(); System.out.println("after"); return result; } }
Struts.xml中的配置
<interceptors> <interceptor name="MyInterceptor" class="com.interceptor.MyInterceptor"></interceptor> </interceptors>
<interceptor-ref name="MyInterceptor"></interceptor-ref> <interceptor-ref name="defaultStack"></interceptor-ref>
0 0
- struts2 自定义拦截器
- 自定义拦截器(转)
- Struts2自定义拦截器
- 自定义拦截器
- Struts2自定义拦截器
- strust2自定义拦截器
- 自定义时间拦截器
- struts2自定义拦截器
- Struts2自定义拦截器
- 拦截器(自定义)
- Struts2自定义拦截器
- Struts2自定义拦截器
- 自定义异常拦截器
- Struts2自定义拦截器
- struts2自定义拦截器
- 自定义拦截器
- Struts2---自定义拦截器
- struts2自定义拦截器
- Java内部类
- 【问底】徐汉彬:亿级Web系统搭建——单机到分布式集群
- JBPM工作流引擎之并发流程&组任务&事件&自定义任务
- NODEMCU刷入AT固件后
- 双向链表
- 自定义拦截器
- 服务器配置git
- 关于Form表单提交中文乱码问题
- 第十章:Java_IO流
- enginx之于分布式部署的创新意义:服务器的服务器,通用分布式服务器引擎,集群引擎-使任何服务器程序纳入统一生态
- Can’t connect to local MySQL server through socket 解决办法
- (45). Spring Boot MyBatis连接Mysql数据库【从零开始学Spring Boot】
- SparkMlib实现线性回归
- 小知识积累(2)