现在的位置: 首页 > 综合 > 正文

Struts2默认拦截器

2012年01月22日 ⁄ 综合 ⁄ 共 2186字 ⁄ 字号 评论关闭

当然还有很多拦截器栈,我们先来看拦截器

拦截器名< xmlnamespace prefix ="o" ns ="urn:schemas-microsoft-com:office:office" />

AliasInterceptor

【别名拦截器】

配置名

alias

描述

允许参数在跨越多个请求时使用不同别名,这个拦截器可将多个action使用不同名字链接起来,然后用于处理同一信息

对应的类

com.opensymphony.xwork2.interceptor.AliasInterceptor

拦截器名

ActionAutowiringInterceptor

【自动装配拦截器】

配置名

autowiring

描述

信息自动装配的拦截器,主要用于当struts2Spring整合时,Struts可以使用自动装配的方式来访问Spring容器中的Bean.

对应的类

com.opensymphony.xwork2.spring.interceptor.ActionAutowiringInterceptor

拦截器名

ChainingInterceptor

【链拦截器】

配置名

chain

描述

允许当前action能够使用上一个被执行action的属性,这个拦截器通常要和“chain”结果类型一起使用(<result
type=”chain”…/>

对应的类

com.opensymphony.xwork2.interceptor.ChainingInterceptor

拦截器名

Checkbox Interceptor

【多选框拦截器】

配置名

checkbox

描述

为没有被选定的多选框增加一个值为false的参数,协助管理多选框(在HTTP请求里,那些没有被选定的多选框通常是没有任何信息的)

对应的类

org.apache.struts2.interceptor.CheckboxInterceptor

拦截器名

ConversionErrorInterceptor

【转换错误拦截器】

配置名

conversionError

描述

将转换错误的信息(包括转换的字符串和参数类型等)存放到action的字段错误集里去

对应的类

org.apache.struts2.interceptor.StrutsConversionErrorInterceptor

拦截器名

CookieInterceptor

Cookie拦截器】

配置名

cookie

描述

使用配置的name,value来指定cookies

对应的类

org.apache.struts2.interceptor.CookieInterceptor

拦截器名

ClearSessionInterceptor

【清除Session拦截器】

配置名

clearSession

描述

负责销毁HttpSeesion

对应的类

N/A

拦截器名

CreateSessionInterceptor

【会话创建拦截器】

配置名

createSession

描述

自动创建一个HttpSession会话(如果会话不存在),用来为需要使用到HttpSession的拦截器服务

对应的类

org.apache.struts2.interceptor.CreateSessionInterceptor

拦截器名

DebuggingInterceptor

【调试拦截器】

配置名

debugging

描述

当使用Struts2的开发模式时,此拦截器会提供更多的调试信息,为开发者提供几种不同调试界面

对应的类

org.apache.struts2.interceptor.debugging.DebuggingInterceptor

拦截器名

ExternalReferencesInterceptor

【扩展引用拦截器】

配置名

externalRef

描述

负责扩展引用

对应的类

com.opensymphony.xwork2.interceptor.ExternalReferencesInterceptor

拦截器名

ExecuteAndWaitInterceptor

【执行和等待拦截器】

配置名

execAndWait

描述

action在后台执行时,给用户显示一个过渡性的等待页面

对应的类

org.apache.struts2.interceptor.ExecuteAndWaitInterceptor

拦截器名

ExceptionMappingInterceptor

【异常拦截器】

配置名

exception

描述

action抛出的异常映射到结果,这样就通过重定向来自动处理异常,一般情况下,应该为最后一个拦截器

对应的类

com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor

拦截器名

FileUploadInterceptor

【文件上传拦截器】

配置名

fileUpload

描述

此拦截器主要用于文件上传,它负责解析表单中文件域的内容

对应的类

org.apache.struts2.interceptor.FileUploadInterceptor

拦截器名

Internatio-nalization Interceptor

【国际化拦截器】

配置名

i18n

描述

这是支持国际化的拦截器,它负责把所选的语言、区域放入用户Session

对应的类

com.opensymphony.xwork2.interceptor.I18nInterceptor

抱歉!评论已关闭.