struts拦截器
来源:互联网 发布:计算机 数学 知乎 编辑:程序博客网 时间:2024/05/22 05:29
struts拦截器
关于struts中有很多的拦截器,对于一个前台请求传递到后台后,首先会经过封装好的struts相关操作类进行处理,然后将处理封装后的相关参数传递到action中,而这里所说的相关类就是指struts拦截器。
那么struts中到底有哪些相关的拦截器呢,由于我们在使用struts的时候都会进行相关包名、命名空间的定义,如下:
<package name="default" namespace="/" extends="struts-default"> <action.....>//相关action定义</package>
那么这里的struts-default到底有什么用呢,为什么要继承自该默认的命名空间呢。首先下载struts先关包后,打开struts2-core-2.3.20.jar后找到文件struts-default.xml,我们会找到该行:
<package name="struts-default" abstract="true">
。
该标签中定义了<result-types>,<interceptors>,<interceptor-stack name="***">,及<default-interceptor-ref name="defaultStack"/>
那么,定义了默认的拦截器为defaultStack,那么该拦截器是如何定义的呢?我们找到如下相关配置:
<interceptor-stack name="defaultStack"> <interceptor-ref name="exception"/> //异常类处理拦截器 <interceptor-ref name="alias"/> <interceptor-ref name="servletConfig"/> <interceptor-ref name="i18n"/> <interceptor-ref name="prepare"/> <interceptor-ref name="chain"/> <interceptor-ref name="scopedModelDriven"/> <interceptor-ref name="modelDriven"/> <interceptor-ref name="fileUpload"/> //文件上传 <interceptor-ref name="checkbox"/> <interceptor-ref name="datetime"/> <interceptor-ref name="multiselect"/> <interceptor-ref name="staticParams"/> <interceptor-ref name="actionMappingParams"/> <interceptor-ref name="params"> <param name="excludeParams">^action:.*,^method:.*</param> </interceptor-ref> <interceptor-ref name="conversionError"/> <interceptor-ref name="validation"> <param name="excludeMethods">input,back,cancel,browse</param> </interceptor-ref> <interceptor-ref name="workflow"> <param name="excludeMethods">input,back,cancel,browse</param> </interceptor-ref> <interceptor-ref name="debugging"/> <interceptor-ref name="deprecation"/></interceptor-stack>
这些拦截器对请求进行了处理封装,比如文件上传拦截器,观看源代码会发现很多有用信息,下一节将介绍文件上传拦截器的相关处理。
0 0
- Struts 2.0 拦截器
- struts拦截器
- struts 拦截器
- Struts 2拦截器
- Struts拦截器
- Struts 2拦截器
- struts拦截器
- Struts之拦截器
- struts拦截器
- Struts 拦截器
- struts拦截器
- struts 2 拦截器
- struts 拦截器
- struts自定义拦截器
- struts 拦截器 interceptor
- struts 拦截器总结
- struts拦截器使用方法
- struts 拦截器
- final finally 和 finalize的区别
- poj1562 Oil Deposits(简单的深搜)
- prepareCall()执行存储过程
- Leetcode: Lowest Common Ancestor of a Binary Tree
- ubuntu 下解决“no java virtual machine was found after searching the following locations:” 方法
- struts拦截器
- 鼠标悬停在按钮上延时响应OnMouseHover、OnMouseMove和OnMouseLeave
- uva 1658 Admiral (最小费最大流)
- Android-真机调试时LogCat不显示的问题
- iOS图片拉伸_小图变大图
- uva 11178 Morley's Theorem
- sgu288:Best Tournament Schedule(构造)
- codevs1029
- unix回射服务器,客服端