Package org.apache.struts2.interceptor
Class StaticParametersInterceptor
java.lang.Object
org.apache.struts2.interceptor.AbstractInterceptor
org.apache.struts2.interceptor.StaticParametersInterceptor
- All Implemented Interfaces:
- Serializable,- ConditionalInterceptor,- Interceptor
 This interceptor populates the action with the static parameters defined in the action configuration. If the action
 implements 
Parameterizable, a map of the static parameters will be also be passed directly to the action.
 The static params will be added to the request params map, unless "merge" is set to false.
 Parameters are typically defined with <param> elements within xwork.xml.
Interceptor parameters:
- None
Extending the interceptor:
There are no extension points to this interceptor.
Example code:
 
 <action name="someAction" class="com.examples.SomeAction">
     <interceptor-ref name="staticParams">
          <param name="parse">true</param>
          <param name="overwrite">false</param>
     </interceptor-ref>
     <result name="success">good_result.ftl</result>
 </action>
 
 - Author:
- Patrick Lightbody
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidaddParametersToContext(ActionContext ac, Map<String, ?> newParams) Adds the parameters into context's ParameterMap.intercept(ActionInvocation invocation) Override to handle interceptionvoidsetDevMode(String mode) voidsetLocalizedTextProvider(LocalizedTextProvider localizedTextProvider) voidvoidsetOverwrite(String value) Overwrites already existing parameters from other sources.voidvoidsetValueStackFactory(ValueStackFactory valueStackFactory) Methods inherited from class org.apache.struts2.interceptor.AbstractInterceptordestroy, init, setDisabled, shouldIntercept
- 
Constructor Details- 
StaticParametersInterceptorpublic StaticParametersInterceptor()
 
- 
- 
Method Details- 
setValueStackFactory
- 
setDevMode
- 
setLocalizedTextProvider
- 
setParse
- 
setMerge
- 
setOverwriteOverwrites already existing parameters from other sources. Static parameters are the successor over previously set parameters, if true.- Parameters:
- value- enable overwrites of already existing parameters from other sources
 
- 
interceptDescription copied from class:AbstractInterceptorOverride to handle interception- Specified by:
- interceptin interface- Interceptor
- Specified by:
- interceptin class- AbstractInterceptor
- Parameters:
- invocation- the action invocation
- Returns:
- the return code, either returned from ActionInvocation.invoke(), or from the interceptor itself.
- Throws:
- Exception- any system-level error, as defined in- Action.execute().
 
- 
retrieveParameters- Parameters:
- ac- The action context
- Returns:
- the parameters from the action mapping in the context. If none found, returns an empty map.
 
- 
addParametersToContextAdds the parameters into context's ParameterMap. As default, static parameters will not overwrite existing parameters from other sources. If you want the static parameters as successor over already existing parameters, set overwrite to true.- Parameters:
- ac- The action context
- newParams- The parameter map to apply
 
 
-