Struts-default.xml简要说明
<struts> <bean name="xwork" /> <bean type="com.opensymphony.xwork2.ObjectFactory" name="struts" /> <bean type="com.opensymphony.xwork2.ActionProxyFactory" name="xwork" name="struts" name="tiger" name="notiger" name="struts" name="struts" /> <bean type="com.opensymphony.xwork2.util.PatternMatcher" name="namedVariable" name="struts" /> <bean type="org.apache.struts2.dispatcher.mapper.ActionMapper" name="composite" /> <bean type="org.apache.struts2.dispatcher.mapper.ActionMapper" name="restful" /> <bean type="org.apache.struts2.dispatcher.mapper.ActionMapper" name="restful2" /><!-- 两个文件上传处理器的Bean --> <bean type="org.apache.struts2.dispatcher.multipart.MultiPartRequest" name="struts" scope="default"/> <bean type="org.apache.struts2.dispatcher.multipart.MultiPartRequest" name="jakarta" scope="default" /> <constant name="struts.multipart.handler" value="jakarta" /><!-- 标签库处理Bean --> <bean type="org.apache.struts2.views.TagLibrary" name="s" /> <bean name="struts" /> <bean name="struts" optional="true" /> <bean /> <bean type="org.apache.struts2.components.template.TemplateEngine" name="ftl" /> <bean type="org.apache.struts2.components.template.TemplateEngine" name="vm" /> <bean type="org.apache.struts2.components.template.TemplateEngine" name="jsp" /> <bean type="com.opensymphony.xwork2.conversion.impl.XWorkConverter" name="struts" /> <bean type="com.opensymphony.xwork2.conversion.impl.XWorkConverter" name="xwork1" /> <bean /> <bean type="com.opensymphony.xwork2.TextProvider" name="xwork1" scope="default" /> <bean type="com.opensymphony.xwork2.TextProvider" name="struts" scope="default" /> <bean type="org.apache.struts2.components.UrlRenderer" name="struts" name="struts" /> <bean type="com.opensymphony.xwork2.util.reflection.ReflectionProvider" name="struts" /> <bean type="com.opensymphony.xwork2.util.reflection.ReflectionContextFactory" name="struts" /> <bean type="com.opensymphony.xwork2.TextProvider" name="system" /> <bean type="com.opensymphony.xwork2.conversion.NullHandler" name="java.lang.Object" /> <bean type="com.opensymphony.xwork2.validator.ActionValidatorManager" name="struts" /> <bean type="com.opensymphony.xwork2.validator.ActionValidatorManager" name="no-annotations" /> <bean type="com.opensymphony.xwork2.validator.ValidatorFactory" /> <bean /> <bean type="ognl.PropertyAccessor" name="com.opensymphony.xwork2.util.CompoundRoot" /> <bean type="ognl.PropertyAccessor" name="java.lang.Object" /> <bean type="ognl.PropertyAccessor" name="java.util.Iterator" /> <bean type="ognl.PropertyAccessor" name="java.util.Enumeration" /> <bean type="ognl.PropertyAccessor" name="java.util.List" /> <bean type="ognl.PropertyAccessor" name="java.util.Set" /> <bean type="ognl.PropertyAccessor" name="java.util.Map" /> <bean type="ognl.PropertyAccessor" name="java.util.Collection" /> <bean type="ognl.PropertyAccessor" name="com.opensymphony.xwork2.ognl.ObjectProxy" /> <bean type="ognl.MethodAccessor" name="java.lang.Object" /> <bean type="ognl.MethodAccessor" name="com.opensymphony.xwork2.util.CompoundRoot" /> <bean /> <bean type="org.apache.struts2.dispatcher.StaticContentLoader" name="struts" /> <bean type="com.opensymphony.xwork2.UnknownHandlerManager" name="struts" /> <!-- Silly workarounds for OGNL since there is currently no way to flush its internal caches --> <bean type="ognl.PropertyAccessor" name="java.util.ArrayList" /> <bean type="ognl.PropertyAccessor" name="java.util.HashSet" /> <bean type="ognl.PropertyAccessor" name="java.util.HashMap" /><!-- 定义抽象的默认包,用于被继承 --> <package name="struts-default" abstract="true"> <result-types> <result-type name="chain" default="true"/> <result-type name="freemarker" /> </result-types> <interceptors> <interceptor name="alias" /> <interceptor name="createSession" /> <interceptor name="debugging" /> <interceptor name="externalRef" /> <interceptor name="checkbox" /> <interceptor name="profiling" /> <interceptor name="roles" /> <interceptor name="jsonValidation" /> <interceptor name="annotationWorkflow" /> <interceptor name="multiselect" /> <!-- Basic stack --> <interceptor-stack name="basicStack"> <interceptor-ref name="exception"/> <interceptor-ref name="servletConfig"/> <interceptor-ref name="prepare"/> <interceptor-ref name="checkbox"/> <interceptor-ref name="multiselect"/> <interceptor-ref name="actionMappingParams"/> <interceptor-ref name="params"> <param name="excludeParams">dojo\..*,^struts\..*</param> </interceptor-ref> <interceptor-ref name="conversionError"/> </interceptor-stack> <!-- Sample validation and workflow stack --> <interceptor-stack name="validationWorkflowStack"> <interceptor-ref name="basicStack"/> <interceptor-ref name="validation"/> <interceptor-ref name="workflow"/> </interceptor-stack> <!-- Sample JSON validation stack --> <interceptor-stack name="jsonValidationWorkflowStack"> <interceptor-ref name="basicStack"/> <interceptor-ref name="validation"> <param name="excludeMethods">input,back,cancel</param> </interceptor-ref> <interceptor-ref name="jsonValidation"/> <interceptor-ref name="workflow"/> </interceptor-stack> <!-- Sample file upload stack --> <interceptor-stack name="fileUploadStack"> <interceptor-ref name="fileUpload"/> <interceptor-ref name="basicStack"/> </interceptor-stack> <!-- Sample model-driven stack --> <interceptor-stack name="modelDrivenStack"> <interceptor-ref name="modelDriven"/> <interceptor-ref name="basicStack"/> </interceptor-stack> <!-- Sample action chaining stack --> <interceptor-stack name="chainStack"> <interceptor-ref name="chain"/> <interceptor-ref name="basicStack"/> </interceptor-stack> <!-- Sample i18n stack --> <interceptor-stack name="i18nStack"> <interceptor-ref name="i18n"/> <interceptor-ref name="basicStack"/> </interceptor-stack> <!-- An example of the paramsPrepareParams trick. This stack is exactly the same as the defaultStack, except that it includes one extra interceptor before the prepare interceptor: the params interceptor. This is useful for when you wish to apply parameters directly to an object that you wish to load externally (such as a DAO or database or service layer), but can't load that object until at least the ID parameter has been loaded. By loading the parameters twice, you can retrieve the object in the prepare() method, allowing the second params interceptor to apply the values on the object. --> <interceptor-stack name="paramsPrepareParamsStack"> <interceptor-ref name="exception"/> <interceptor-ref name="alias"/> <interceptor-ref name="i18n"/> <interceptor-ref name="checkbox"/> <interceptor-ref name="multiselect"/> <interceptor-ref name="params"> <param name="excludeParams">dojo\..*,^struts\..*</param> </interceptor-ref> <interceptor-ref name="servletConfig"/> <interceptor-ref name="prepare"/> <interceptor-ref name="chain"/> <interceptor-ref name="modelDriven"/> <interceptor-ref name="fileUpload"/> <interceptor-ref name="staticParams"/> <interceptor-ref name="actionMappingParams"/> <interceptor-ref name="params"> <param name="excludeParams">dojo\..*,^struts\..*</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> <!-- A complete stack with all the common interceptors in place. Generally, this stack should be the one you use, though it may do more than you need. Also, the ordering can be switched around (ex: if you wish to have your servlet-related objects applied before prepare() is called, you'd need to move servletConfig interceptor up. This stack also excludes from the normal validation and workflow the method names input, back, and cancel. These typically are associated with requests that should not be validated. --> <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="debugging"/> <interceptor-ref name="scopedModelDriven"/> <interceptor-ref name="modelDriven"/> <interceptor-ref name="fileUpload"/> <interceptor-ref name="checkbox"/> <interceptor-ref name="multiselect"/> <interceptor-ref name="staticParams"/> <interceptor-ref name="actionMappingParams"/> <interceptor-ref name="params"> <param name="excludeParams">dojo\..*,^struts\..*</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> <!-- The completeStack is here for backwards compatibility for applications that still refer to the defaultStack by the old name --> <interceptor-stack name="completeStack"> <interceptor-ref name="defaultStack"/> </interceptor-stack> <!-- Sample execute and wait stack. Note: execAndWait should always be the *last* interceptor. --> <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> </interceptors> <!-- 配置上面定义的默认拦截器--> <default-interceptor-ref name="defaultStack"/> <!-- 配置默认执行类为ActionSupport--> <default-class-ref /> </package></struts>
?