- 浏览: 12101 次
- 性别:
- 来自: 杭州
文章分类
最新评论
1) struts-default.xml
这个文件是struts2框架默认加载的配置文件。它定义struts2一些核心的bean和拦截器。
view plaincopy to clipboardprint?
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<!--struts2中工厂bean的定义-->
<bean class="com.opensymphony.xwork2.ObjectFactory" name="xwork" />
<bean type="com.opensymphony.xwork2.ObjectFactory" name="struts" class="org.apache.struts2.impl.StrutsObjectFactory" />
<bean type="com.opensymphony.xwork2.ActionProxyFactory" name="xwork" class="com.opensymphony.xwork2.DefaultActionProxyFactory"/>
<bean type="com.opensymphony.xwork2.ActionProxyFactory" name="struts" class="org.apache.struts2.impl.StrutsActionProxyFactory"/>
<!--类型检测bean的定义-->
<bean type="com.opensymphony.xwork2.util.ObjectTypeDeterminer" name="tiger" class="com.opensymphony.xwork2.util.GenericsObjectTypeDeterminer"/>
<bean type="com.opensymphony.xwork2.util.ObjectTypeDeterminer" name="notiger" class="com.opensymphony.xwork2.util.DefaultObjectTypeDeterminer"/>
<bean type="com.opensymphony.xwork2.util.ObjectTypeDeterminer" name="struts" class="com.opensymphony.xwork2.util.DefaultObjectTypeDeterminer"/>
<!--文件上传bean的定义-->
<bean type="org.apache.struts2.dispatcher.mapper.ActionMapper" name="struts" class="org.apache.struts2.dispatcher.mapper.DefaultActionMapper" />
<bean type="org.apache.struts2.dispatcher.mapper.ActionMapper" name="composite" class="org.apache.struts2.dispatcher.mapper.CompositeActionMapper" />
<bean type="org.apache.struts2.dispatcher.mapper.ActionMapper" name="restful" class="org.apache.struts2.dispatcher.mapper.RestfulActionMapper" />
<bean type="org.apache.struts2.dispatcher.mapper.ActionMapper" name="restful2" class="org.apache.struts2.dispatcher.mapper.Restful2ActionMapper" />
<bean type="org.apache.struts2.dispatcher.multipart.MultiPartRequest" name="struts" class="org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest" scope="default" optional="true"/>
<bean type="org.apache.struts2.dispatcher.multipart.MultiPartRequest" name="jakarta" class="org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest" scope="default" optional="true" />
<!--标签库bean的定义-->
<bean type="org.apache.struts2.views.TagLibrary" name="s" class="org.apache.struts2.views.DefaultTagLibrary" />
<!--一些常用视图bean的定义-->
<bean class="org.apache.struts2.views.freemarker.FreemarkerManager" name="struts" optional="true"/>
<bean class="org.apache.struts2.views.velocity.VelocityManager" name="struts" optional="true" />
<bean class="org.apache.struts2.components.template.TemplateEngineManager" />
<bean type="org.apache.struts2.components.template.TemplateEngine" name="ftl" class="org.apache.struts2.components.template.FreemarkerTemplateEngine" />
<bean type="org.apache.struts2.components.template.TemplateEngine" name="vm" class="org.apache.struts2.components.template.VelocityTemplateEngine" />
<bean type="org.apache.struts2.components.template.TemplateEngine" name="jsp" class="org.apache.struts2.components.template.JspTemplateEngine" />
<!--类型转换bean的定义-->
<bean type="com.opensymphony.xwork2.util.XWorkConverter" name="xwork1" class="com.opensymphony.xwork2.util.XWorkConverter" />
<bean type="com.opensymphony.xwork2.util.XWorkConverter" name="struts" class="com.opensymphony.xwork2.util.AnnotationXWorkConverter" />
<bean type="com.opensymphony.xwork2.TextProvider" name="xwork1" class="com.opensymphony.xwork2.TextProviderSupport" />
<bean type="com.opensymphony.xwork2.TextProvider" name="struts" class="com.opensymphony.xwork2.TextProviderSupport" />
<!-- Struts2中一些可以静态注入的bean,也就是不需要实例化的 -->
<bean class="com.opensymphony.xwork2.ObjectFactory" static="true" />
<bean class="com.opensymphony.xwork2.util.XWorkConverter" static="true" />
<bean class="com.opensymphony.xwork2.util.OgnlValueStack" static="true" />
<bean class="org.apache.struts2.dispatcher.Dispatcher" static="true" />
<bean class="org.apache.struts2.components.Include" static="true" />
<bean class="org.apache.struts2.dispatcher.FilterDispatcher" static="true" />
<bean class="org.apache.struts2.views.util.ContextUtil" static="true" />
<bean class="org.apache.struts2.views.util.UrlHelper" static="true" />
<!-- 定义Struts2默认包-->
<package name="struts-default" abstract="true">
<!-- 结果类型的种类-->
<result-types>
<result-type name="chain" class="com.opensymphony.xwork2.ActionChainResult"/>
<result-type name="dispatcher" class="org.apache.struts2.dispatcher.ServletDispatcherResult" default="true"/>
<result-type name="freemarker" class="org.apache.struts2.views.freemarker.FreemarkerResult"/>
<result-type name="httpheader" class="org.apache.struts2.dispatcher.HttpHeaderResult"/>
<result-type name="redirect" class="org.apache.struts2.dispatcher.ServletRedirectResult"/>
<result-type name="redirectAction" class="org.apache.struts2.dispatcher.ServletActionRedirectResult"/>
<result-type name="stream" class="org.apache.struts2.dispatcher.StreamResult"/>
<result-type name="velocity" class="org.apache.struts2.dispatcher.VelocityResult"/>
<result-type name="xslt" class="org.apache.struts2.views.xslt.XSLTResult"/>
<result-type name="plainText" class="org.apache.struts2.dispatcher.PlainTextResult" />
<result-type name="redirect-action" class="org.apache.struts2.dispatcher.ServletActionRedirectResult"/>
<result-type name="plaintext" class="org.apache.struts2.dispatcher.PlainTextResult" />
</result-types>
<!--struts2中拦截器的定义-->
<interceptors>
<!--实现在不同请求中相似参数别名的准换-->
<interceptor name="alias" class="com.opensymphony.xwork2.interceptor.AliasInterceptor"/>
<!--与Spring整合时自动装配的拦截器-->
<interceptor name="autowiring" class="com.opensymphony.xwork2.spring.interceptor.ActionAutowiringInterceptor"/>
<!--构建一个action链,使当前action可以访问前一个action,与<result-type="chain" />配合使用-->
<interceptor name="chain" class="com.opensymphony.xwork2.interceptor.ChainingInterceptor"/>
<!--负责类型转换的拦截器-->
<interceptor name="conversionError" class="org.apache.struts2.interceptor.StrutsConversionErrorInterceptor"/>
<!--使用配置的name,value来是指cookies -->
<interceptor name="cookie" class="org.apache.struts2.interceptor.CookieInterceptor"/>
<!--负责创建httpSession-->
<interceptor name="createSession" class="org.apache.struts2.interceptor.CreateSessionInterceptor" />
<!--输出调试信息-->
<interceptor name="debugging" class="org.apache.struts2.interceptor.debugging.DebuggingInterceptor" />
<!--扩展引用-->
<interceptor name="externalRef" class="com.opensymphony.xwork2.interceptor.ExternalReferencesInterceptor"/>
<!--后台执行action负责发送等待画面给用户-->
<interceptor name="execAndWait" class="org.apache.struts2.interceptor.ExecuteAndWaitInterceptor"/>
<!--异常处理-->
<interceptor name="exception" class="com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor"/>
<!--文件上传,解析表单域的内容-->
<interceptor name="fileUpload" class="org.apache.struts2.interceptor.FileUploadInterceptor"/>
<!--支持国际化-->
<interceptor name="i18n" class="com.opensymphony.xwork2.interceptor.I18nInterceptor"/>
<!--日志记录-->
<interceptor name="logger" class="com.opensymphony.xwork2.interceptor.LoggingInterceptor"/>
<!--模型拦截器,当action实现了ModelDriven接口时,负责把getModel的结果放入valueStack中-->
<interceptor name="modelDriven" class="com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor"/>
<!--有生命周期的ModelDriven-->
<interceptor name="scopedModelDriven" class="com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor"/>
<!--负责解析请求中的参数,并赋值给action中对应的属性-->
<interceptor name="params" class="com.opensymphony.xwork2.interceptor.ParametersInterceptor"/>
<!--实现该Preparable接口的action,会调用拦截器的prepare方法-->
<interceptor name="prepare" class="com.opensymphony.xwork2.interceptor.PrepareInterceptor"/>
<!--负责将action 标签下的param参数值传递给action实例-->
<interceptor name="staticParams" class="com.opensymphony.xwork2.interceptor.StaticParametersInterceptor"/>
<!--范围转换-->
<interceptor name="scope" class="org.apache.struts2.interceptor.ScopeInterceptor"/>
<!--用于访问Servlet API-->
<interceptor name="servletConfig" class="org.apache.struts2.interceptor.ServletConfigInterceptor"/>
<interceptor name="sessionAutowiring" class="org.apache.struts2.spring.interceptor.SessionContextAutowiringInterceptor"/>
<!--输出action执行时间-->
<interceptor name="timer" class="com.opensymphony.xwork2.interceptor.TimerInterceptor"/>
<!--防止表单重复提交-->
<interceptor name="token" class="org.apache.struts2.interceptor.TokenInterceptor"/>
<!--与token拦截器相似,只是把token保存到HttpSession-->
<interceptor name="tokenSession" class="org.apache.struts2.interceptor.TokenSessionStoreInterceptor"/>
<!--负责表单字段的验证 *-validation.xml-->
<interceptor name="validation" class="org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor"/>
<!--负责执行action的validate()-->
<interceptor name="workflow" class="com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor"/>
<!--存储和重新获取Action 消息/错误/字段错误为Action,实现ValidationAware接口到seesion-->
<interceptor name="store" class="org.apache.struts2.interceptor.MessageStoreInterceptor" />
<!--添加自动checkbox处理代码,这样检探测checkbox和添加它作为一个参数使用默认值(通常’false’).使用一个指定名字隐藏字段探测没提交的checkbox-->
<interceptor name="checkbox" class="org.apache.struts2.interceptor.CheckboxInterceptor" />
<interceptor name="profiling" class="org.apache.struts2.interceptor.ProfilingActivationInterceptor" />
<!--JAAS服务拦截器-->
<interceptor name="roles" class="org.apache.struts2.interceptor.RolesInterceptor" />
<!-- 一个基本的拦截器栈 -->
<interceptor-stack name="basicStack">
<interceptor-ref name="exception"/>
<interceptor-ref name="servletConfig"/>
<interceptor-ref name="prepare"/>
<interceptor-ref name="checkbox"/>
<interceptor-ref name="params"/>
<interceptor-ref name="conversionError"/>
</interceptor-stack>
<!-- 简单的validtion和webflow栈 -->
<interceptor-stack name="validationWorkflowStack">
<interceptor-ref name="basicStack"/>
<interceptor-ref name="validation"/>
<interceptor-ref name="workflow"/>
</interceptor-stack>
<!-- 文件上传的拦截器栈 -->
<interceptor-stack name="fileUploadStack">
<interceptor-ref name="fileUpload"/>
<interceptor-ref name="basicStack"/>
</interceptor-stack>
<!-- model-driven 栈 -->
<interceptor-stack name="modelDrivenStack">
<interceptor-ref name="modelDriven"/>
<interceptor-ref name="basicStack"/>
</interceptor-stack>
<!-- action链的拦截器栈 -->
<interceptor-stack name="chainStack">
<interceptor-ref name="chain"/>
<interceptor-ref name="basicStack"/>
</interceptor-stack>
<!-- i18n 拦截器栈 -->
<interceptor-stack name="i18nStack">
<interceptor-ref name="i18n"/>
<interceptor-ref name="basicStack"/>
</interceptor-stack>
<!-- 结合preparable和ModenDriven拦截器-->
<interceptor-stack name="paramsPrepareParamsStack">
<interceptor-ref name="exception"/>
<interceptor-ref name="alias"/>
<interceptor-ref name="params"/>
<interceptor-ref name="servletConfig"/>
<interceptor-ref name="prepare"/>
<interceptor-ref name="i18n"/>
<interceptor-ref name="chain"/>
<interceptor-ref name="modelDriven"/>
<interceptor-ref name="fileUpload"/>
<interceptor-ref name="checkbox"/>
<interceptor-ref name="staticParams"/>
<interceptor-ref name="params"/>
<interceptor-ref name="conversionError"/>
<interceptor-ref name="validation">
<param name="excludeMethods">input,back,cancel</param>
</interceptor-ref>
<interceptor-ref name="workflow">
<param name="excludeMethods">input,back,cancel</param>
</interceptor-ref>
</interceptor-stack>
<!--定义默认的拦截器栈 -->
<interceptor-stack name="defaultStack">
<interceptor-ref name="exception"/>
<interceptor-ref name="alias"/>
<interceptor-ref name="servletConfig"/>
<interceptor-ref name="prepare"/>
<interceptor-ref name="i18n"/>
<interceptor-ref name="chain"/>
<interceptor-ref name="debugging"/>
<interceptor-ref name="profiling"/>
<interceptor-ref name="scopedModelDriven"/>
<interceptor-ref name="modelDriven"/>
<interceptor-ref name="fileUpload"/>
<interceptor-ref name="checkbox"/>
<interceptor-ref name="staticParams"/>
<interceptor-ref name="params">
<param name="excludeParams">dojo\..*</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-stack>
<interceptor-stack name="completeStack">
<interceptor-ref name="defaultStack"/>
</interceptor-stack>
<interceptor-stack name="executeAndWaitStack">
<interceptor-ref name="execAndWait">
<param name="excludeMethods">input,back,cancel</param>
</interceptor-ref>
<interceptor-ref name="defaultStack"/>
<interceptor-ref name="execAndWait">
<param name="excludeMethods">input,back,cancel</param>
</interceptor-ref>
</interceptor-stack>
<interceptor name="external-ref" class="com.opensymphony.xwork2.interceptor.ExternalReferencesInterceptor"/>
<interceptor name="model-driven" class="com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor"/>
<interceptor name="static-params" class="com.opensymphony.xwork2.interceptor.StaticParametersInterceptor"/>
<interceptor name="scoped-model-driven" class="com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor"/>
<interceptor name="servlet-config" class="org.apache.struts2.interceptor.ServletConfigInterceptor"/>
<interceptor name="token-session" class="org.apache.struts2.interceptor.TokenSessionStoreInterceptor"/>
</interceptors>
<!--定义默认拦截器为"defaultStack"-->
<default-interceptor-ref name="defaultStack"/>
</package>
</struts>
这个文件是struts2框架默认加载的配置文件。它定义struts2一些核心的bean和拦截器。
view plaincopy to clipboardprint?
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<!--struts2中工厂bean的定义-->
<bean class="com.opensymphony.xwork2.ObjectFactory" name="xwork" />
<bean type="com.opensymphony.xwork2.ObjectFactory" name="struts" class="org.apache.struts2.impl.StrutsObjectFactory" />
<bean type="com.opensymphony.xwork2.ActionProxyFactory" name="xwork" class="com.opensymphony.xwork2.DefaultActionProxyFactory"/>
<bean type="com.opensymphony.xwork2.ActionProxyFactory" name="struts" class="org.apache.struts2.impl.StrutsActionProxyFactory"/>
<!--类型检测bean的定义-->
<bean type="com.opensymphony.xwork2.util.ObjectTypeDeterminer" name="tiger" class="com.opensymphony.xwork2.util.GenericsObjectTypeDeterminer"/>
<bean type="com.opensymphony.xwork2.util.ObjectTypeDeterminer" name="notiger" class="com.opensymphony.xwork2.util.DefaultObjectTypeDeterminer"/>
<bean type="com.opensymphony.xwork2.util.ObjectTypeDeterminer" name="struts" class="com.opensymphony.xwork2.util.DefaultObjectTypeDeterminer"/>
<!--文件上传bean的定义-->
<bean type="org.apache.struts2.dispatcher.mapper.ActionMapper" name="struts" class="org.apache.struts2.dispatcher.mapper.DefaultActionMapper" />
<bean type="org.apache.struts2.dispatcher.mapper.ActionMapper" name="composite" class="org.apache.struts2.dispatcher.mapper.CompositeActionMapper" />
<bean type="org.apache.struts2.dispatcher.mapper.ActionMapper" name="restful" class="org.apache.struts2.dispatcher.mapper.RestfulActionMapper" />
<bean type="org.apache.struts2.dispatcher.mapper.ActionMapper" name="restful2" class="org.apache.struts2.dispatcher.mapper.Restful2ActionMapper" />
<bean type="org.apache.struts2.dispatcher.multipart.MultiPartRequest" name="struts" class="org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest" scope="default" optional="true"/>
<bean type="org.apache.struts2.dispatcher.multipart.MultiPartRequest" name="jakarta" class="org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest" scope="default" optional="true" />
<!--标签库bean的定义-->
<bean type="org.apache.struts2.views.TagLibrary" name="s" class="org.apache.struts2.views.DefaultTagLibrary" />
<!--一些常用视图bean的定义-->
<bean class="org.apache.struts2.views.freemarker.FreemarkerManager" name="struts" optional="true"/>
<bean class="org.apache.struts2.views.velocity.VelocityManager" name="struts" optional="true" />
<bean class="org.apache.struts2.components.template.TemplateEngineManager" />
<bean type="org.apache.struts2.components.template.TemplateEngine" name="ftl" class="org.apache.struts2.components.template.FreemarkerTemplateEngine" />
<bean type="org.apache.struts2.components.template.TemplateEngine" name="vm" class="org.apache.struts2.components.template.VelocityTemplateEngine" />
<bean type="org.apache.struts2.components.template.TemplateEngine" name="jsp" class="org.apache.struts2.components.template.JspTemplateEngine" />
<!--类型转换bean的定义-->
<bean type="com.opensymphony.xwork2.util.XWorkConverter" name="xwork1" class="com.opensymphony.xwork2.util.XWorkConverter" />
<bean type="com.opensymphony.xwork2.util.XWorkConverter" name="struts" class="com.opensymphony.xwork2.util.AnnotationXWorkConverter" />
<bean type="com.opensymphony.xwork2.TextProvider" name="xwork1" class="com.opensymphony.xwork2.TextProviderSupport" />
<bean type="com.opensymphony.xwork2.TextProvider" name="struts" class="com.opensymphony.xwork2.TextProviderSupport" />
<!-- Struts2中一些可以静态注入的bean,也就是不需要实例化的 -->
<bean class="com.opensymphony.xwork2.ObjectFactory" static="true" />
<bean class="com.opensymphony.xwork2.util.XWorkConverter" static="true" />
<bean class="com.opensymphony.xwork2.util.OgnlValueStack" static="true" />
<bean class="org.apache.struts2.dispatcher.Dispatcher" static="true" />
<bean class="org.apache.struts2.components.Include" static="true" />
<bean class="org.apache.struts2.dispatcher.FilterDispatcher" static="true" />
<bean class="org.apache.struts2.views.util.ContextUtil" static="true" />
<bean class="org.apache.struts2.views.util.UrlHelper" static="true" />
<!-- 定义Struts2默认包-->
<package name="struts-default" abstract="true">
<!-- 结果类型的种类-->
<result-types>
<result-type name="chain" class="com.opensymphony.xwork2.ActionChainResult"/>
<result-type name="dispatcher" class="org.apache.struts2.dispatcher.ServletDispatcherResult" default="true"/>
<result-type name="freemarker" class="org.apache.struts2.views.freemarker.FreemarkerResult"/>
<result-type name="httpheader" class="org.apache.struts2.dispatcher.HttpHeaderResult"/>
<result-type name="redirect" class="org.apache.struts2.dispatcher.ServletRedirectResult"/>
<result-type name="redirectAction" class="org.apache.struts2.dispatcher.ServletActionRedirectResult"/>
<result-type name="stream" class="org.apache.struts2.dispatcher.StreamResult"/>
<result-type name="velocity" class="org.apache.struts2.dispatcher.VelocityResult"/>
<result-type name="xslt" class="org.apache.struts2.views.xslt.XSLTResult"/>
<result-type name="plainText" class="org.apache.struts2.dispatcher.PlainTextResult" />
<result-type name="redirect-action" class="org.apache.struts2.dispatcher.ServletActionRedirectResult"/>
<result-type name="plaintext" class="org.apache.struts2.dispatcher.PlainTextResult" />
</result-types>
<!--struts2中拦截器的定义-->
<interceptors>
<!--实现在不同请求中相似参数别名的准换-->
<interceptor name="alias" class="com.opensymphony.xwork2.interceptor.AliasInterceptor"/>
<!--与Spring整合时自动装配的拦截器-->
<interceptor name="autowiring" class="com.opensymphony.xwork2.spring.interceptor.ActionAutowiringInterceptor"/>
<!--构建一个action链,使当前action可以访问前一个action,与<result-type="chain" />配合使用-->
<interceptor name="chain" class="com.opensymphony.xwork2.interceptor.ChainingInterceptor"/>
<!--负责类型转换的拦截器-->
<interceptor name="conversionError" class="org.apache.struts2.interceptor.StrutsConversionErrorInterceptor"/>
<!--使用配置的name,value来是指cookies -->
<interceptor name="cookie" class="org.apache.struts2.interceptor.CookieInterceptor"/>
<!--负责创建httpSession-->
<interceptor name="createSession" class="org.apache.struts2.interceptor.CreateSessionInterceptor" />
<!--输出调试信息-->
<interceptor name="debugging" class="org.apache.struts2.interceptor.debugging.DebuggingInterceptor" />
<!--扩展引用-->
<interceptor name="externalRef" class="com.opensymphony.xwork2.interceptor.ExternalReferencesInterceptor"/>
<!--后台执行action负责发送等待画面给用户-->
<interceptor name="execAndWait" class="org.apache.struts2.interceptor.ExecuteAndWaitInterceptor"/>
<!--异常处理-->
<interceptor name="exception" class="com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor"/>
<!--文件上传,解析表单域的内容-->
<interceptor name="fileUpload" class="org.apache.struts2.interceptor.FileUploadInterceptor"/>
<!--支持国际化-->
<interceptor name="i18n" class="com.opensymphony.xwork2.interceptor.I18nInterceptor"/>
<!--日志记录-->
<interceptor name="logger" class="com.opensymphony.xwork2.interceptor.LoggingInterceptor"/>
<!--模型拦截器,当action实现了ModelDriven接口时,负责把getModel的结果放入valueStack中-->
<interceptor name="modelDriven" class="com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor"/>
<!--有生命周期的ModelDriven-->
<interceptor name="scopedModelDriven" class="com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor"/>
<!--负责解析请求中的参数,并赋值给action中对应的属性-->
<interceptor name="params" class="com.opensymphony.xwork2.interceptor.ParametersInterceptor"/>
<!--实现该Preparable接口的action,会调用拦截器的prepare方法-->
<interceptor name="prepare" class="com.opensymphony.xwork2.interceptor.PrepareInterceptor"/>
<!--负责将action 标签下的param参数值传递给action实例-->
<interceptor name="staticParams" class="com.opensymphony.xwork2.interceptor.StaticParametersInterceptor"/>
<!--范围转换-->
<interceptor name="scope" class="org.apache.struts2.interceptor.ScopeInterceptor"/>
<!--用于访问Servlet API-->
<interceptor name="servletConfig" class="org.apache.struts2.interceptor.ServletConfigInterceptor"/>
<interceptor name="sessionAutowiring" class="org.apache.struts2.spring.interceptor.SessionContextAutowiringInterceptor"/>
<!--输出action执行时间-->
<interceptor name="timer" class="com.opensymphony.xwork2.interceptor.TimerInterceptor"/>
<!--防止表单重复提交-->
<interceptor name="token" class="org.apache.struts2.interceptor.TokenInterceptor"/>
<!--与token拦截器相似,只是把token保存到HttpSession-->
<interceptor name="tokenSession" class="org.apache.struts2.interceptor.TokenSessionStoreInterceptor"/>
<!--负责表单字段的验证 *-validation.xml-->
<interceptor name="validation" class="org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor"/>
<!--负责执行action的validate()-->
<interceptor name="workflow" class="com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor"/>
<!--存储和重新获取Action 消息/错误/字段错误为Action,实现ValidationAware接口到seesion-->
<interceptor name="store" class="org.apache.struts2.interceptor.MessageStoreInterceptor" />
<!--添加自动checkbox处理代码,这样检探测checkbox和添加它作为一个参数使用默认值(通常’false’).使用一个指定名字隐藏字段探测没提交的checkbox-->
<interceptor name="checkbox" class="org.apache.struts2.interceptor.CheckboxInterceptor" />
<interceptor name="profiling" class="org.apache.struts2.interceptor.ProfilingActivationInterceptor" />
<!--JAAS服务拦截器-->
<interceptor name="roles" class="org.apache.struts2.interceptor.RolesInterceptor" />
<!-- 一个基本的拦截器栈 -->
<interceptor-stack name="basicStack">
<interceptor-ref name="exception"/>
<interceptor-ref name="servletConfig"/>
<interceptor-ref name="prepare"/>
<interceptor-ref name="checkbox"/>
<interceptor-ref name="params"/>
<interceptor-ref name="conversionError"/>
</interceptor-stack>
<!-- 简单的validtion和webflow栈 -->
<interceptor-stack name="validationWorkflowStack">
<interceptor-ref name="basicStack"/>
<interceptor-ref name="validation"/>
<interceptor-ref name="workflow"/>
</interceptor-stack>
<!-- 文件上传的拦截器栈 -->
<interceptor-stack name="fileUploadStack">
<interceptor-ref name="fileUpload"/>
<interceptor-ref name="basicStack"/>
</interceptor-stack>
<!-- model-driven 栈 -->
<interceptor-stack name="modelDrivenStack">
<interceptor-ref name="modelDriven"/>
<interceptor-ref name="basicStack"/>
</interceptor-stack>
<!-- action链的拦截器栈 -->
<interceptor-stack name="chainStack">
<interceptor-ref name="chain"/>
<interceptor-ref name="basicStack"/>
</interceptor-stack>
<!-- i18n 拦截器栈 -->
<interceptor-stack name="i18nStack">
<interceptor-ref name="i18n"/>
<interceptor-ref name="basicStack"/>
</interceptor-stack>
<!-- 结合preparable和ModenDriven拦截器-->
<interceptor-stack name="paramsPrepareParamsStack">
<interceptor-ref name="exception"/>
<interceptor-ref name="alias"/>
<interceptor-ref name="params"/>
<interceptor-ref name="servletConfig"/>
<interceptor-ref name="prepare"/>
<interceptor-ref name="i18n"/>
<interceptor-ref name="chain"/>
<interceptor-ref name="modelDriven"/>
<interceptor-ref name="fileUpload"/>
<interceptor-ref name="checkbox"/>
<interceptor-ref name="staticParams"/>
<interceptor-ref name="params"/>
<interceptor-ref name="conversionError"/>
<interceptor-ref name="validation">
<param name="excludeMethods">input,back,cancel</param>
</interceptor-ref>
<interceptor-ref name="workflow">
<param name="excludeMethods">input,back,cancel</param>
</interceptor-ref>
</interceptor-stack>
<!--定义默认的拦截器栈 -->
<interceptor-stack name="defaultStack">
<interceptor-ref name="exception"/>
<interceptor-ref name="alias"/>
<interceptor-ref name="servletConfig"/>
<interceptor-ref name="prepare"/>
<interceptor-ref name="i18n"/>
<interceptor-ref name="chain"/>
<interceptor-ref name="debugging"/>
<interceptor-ref name="profiling"/>
<interceptor-ref name="scopedModelDriven"/>
<interceptor-ref name="modelDriven"/>
<interceptor-ref name="fileUpload"/>
<interceptor-ref name="checkbox"/>
<interceptor-ref name="staticParams"/>
<interceptor-ref name="params">
<param name="excludeParams">dojo\..*</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-stack>
<interceptor-stack name="completeStack">
<interceptor-ref name="defaultStack"/>
</interceptor-stack>
<interceptor-stack name="executeAndWaitStack">
<interceptor-ref name="execAndWait">
<param name="excludeMethods">input,back,cancel</param>
</interceptor-ref>
<interceptor-ref name="defaultStack"/>
<interceptor-ref name="execAndWait">
<param name="excludeMethods">input,back,cancel</param>
</interceptor-ref>
</interceptor-stack>
<interceptor name="external-ref" class="com.opensymphony.xwork2.interceptor.ExternalReferencesInterceptor"/>
<interceptor name="model-driven" class="com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor"/>
<interceptor name="static-params" class="com.opensymphony.xwork2.interceptor.StaticParametersInterceptor"/>
<interceptor name="scoped-model-driven" class="com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor"/>
<interceptor name="servlet-config" class="org.apache.struts2.interceptor.ServletConfigInterceptor"/>
<interceptor name="token-session" class="org.apache.struts2.interceptor.TokenSessionStoreInterceptor"/>
</interceptors>
<!--定义默认拦截器为"defaultStack"-->
<default-interceptor-ref name="defaultStack"/>
</package>
</struts>
相关推荐
为了在Eclipse这样的集成开发环境中获得代码提示和自动完成,我们需要引入DTD(文档类型定义)文件,例如`struts-2.3.dtd`。 DTD是一个XML规范,它定义了一组元素和属性,以及它们的结构和限制。`struts-2.3.dtd`为...
6. **struts-default.xml** 和 **struts-plugin.xml** 文件:默认的配置文件,定义了框架的行为和插件。 7. **LICENSE** 和 **NOTICE** 文件:包含了框架的许可信息和版权声明。 Struts 2.3.x系列在功能上提供了很...
6. **配置文件**:如struts-default.xml、struts-plugin.xml等,它们定义了框架的行为和插件设置。 总的来说,Struts 2.3.16.3-all是一个全面的开发包,旨在帮助开发者快速、高效地构建Java Web应用程序,同时也...
- `struts-2.0.11.2/config/`:配置文件,如`struts-default.xml`, `struts-plugin.xml`等。 为了使用这个压缩包,开发者通常会将其解压后将库文件添加到项目的类路径中,参考示例或文档了解如何配置和使用Struts 2...
3. **配置文件**:Struts2使用XML配置文件(struts.xml或struts-default.xml)来定义Action类、结果类型、拦截器等。此外,还可以使用注解方式来简化配置。 4. **拦截器(Interceptor)**:拦截器是Struts2的一个...
2. **配置文件**:Struts2使用XML配置文件(通常命名为struts.xml或struts-default.xml)来定义Action、结果、拦截器等。这些配置告诉Struts如何映射HTTP请求到Action类,以及Action执行后如何显示结果。 3. **拦截...
- 使用`struts.xml`或`struts-default.xml`等配置文件来配置Action、结果页面和拦截器栈。 6. **安全性**: - Struts2.0.11.2版本在安全方面已经进行了多次优化,但依然需要注意其漏洞,例如著名的OGNL注入漏洞,...
- **其他配置文件**:如struts-default.xml、struts-plugin.xml等,定义了框架的默认行为和插件配置。 使用这个压缩包,开发者可以快速搭建一个Struts 2的开发环境,通过阅读文档、查看源代码以及运行示例,掌握...
<package name="default" namespace="/" extends="struts-default"> <!-- 全局允许的方法 --> <global-allowed-methods>regex:.*</global-allowed-methods> <!-- 添加具体的Action配置 --> </struts> ``` - *...
2. **配置文件**:Struts 2使用两个主要的配置文件,分别是struts.xml和struts-default.xml。struts.xml是自定义的配置,用于定义Action类、结果类型、拦截器等;struts-default.xml是框架默认的配置,包含了一些预...
2. **配置审查**:检查并确保所有的配置文件(如struts-default.xml、struts-plugin.xml等)正确无误,避免不必要的暴露。 3. **输入验证**:对用户输入进行严格的校验,防止恶意数据注入。 4. **使用拦截器**:通过...
查看文档API:Build path 后的类库中,奶瓶图标找到struts-core-2.5.16.jar 右键-->properties-->javadoc location :输入网址 或选择源码DOC目录 8.拦截器:web.xml 配置拦截器<filter> struts2.5的filter-...
4. **struts-default.xml**:此文件包含Struts 2的默认配置,定义了一些核心bean和拦截器,会被自动包含到struts.xml中。它在struts2-core.jar中可以找到。 5. **其他配置文件**:如velocity.properties(Velocity...
4. **示例代码和文档**:可能还包含了示例应用、教程文档或API文档,帮助开发者更好地理解和使用Struts2框架。 配置Struts2涉及到以下几个关键步骤: 1. **添加依赖**:将Struts2的JAR文件添加到项目的类路径中,...
4. **struts-default.xml**:Struts2框架默认加载的配置文件,定义核心bean和拦截器,自动包含到struts.xml中,提供标准配置。 5. **其它配置文件**:如velocity.properties、struts-default.vm、struts-plugin.xml...
- **struts-default.xml**:struts2框架默认加载的配置文件,定义了核心bean和拦截器,通常通过`<package extends="struts-default">`的方式被struts.xml包含。 - **其他配置文件**:例如velocity.properties、...
- **struts-default.xml**:预定义的配置文件,定义核心bean和拦截器,自动包含在`struts.xml`中,并提供标准配置。 - **velocity.properties, struts-default.vm, struts-plugin.xml**:其他配置文件,如Velocity...
- 其他配置文件如velocity.properties、struts-default.vm和struts-plugin.xml等也是Struts2运行的重要组成部分。 为了在MyEclipse中获得XML文件的代码提示,需要手动导入Struts2的DTD: 1. 打开MyEclipse的首选项...
4. `struts-default.xml`:这是Struts2框架默认加载的配置文件,定义了核心bean和拦截器,会被自动包含到`struts.xml`中。它包含了一些标准配置,位于`struts2-core.jar`内。 5. 其他配置文件如`velocity....