Package org.apache.struts2.interceptor
Class ModelDrivenInterceptor
java.lang.Object
org.apache.struts2.interceptor.AbstractInterceptor
org.apache.struts2.interceptor.ModelDrivenInterceptor
- All Implemented Interfaces:
- Serializable,- ConditionalInterceptor,- Interceptor
 Watches for 
ModelDriven actions and adds the action's model on to the value stack.
  Note:  The ModelDrivenInterceptor must come before the both StaticParametersInterceptor and
 ParametersInterceptor if you want the parameters to be applied to
 the model.
 
Note: The ModelDrivenInterceptor will only push the model into the stack when the model is not null, else it will be ignored.
Interceptor parameters:
- refreshModelBeforeResult - set to true if you want the model to be refreshed on the value stack after action execution and before result execution. The setting is useful if you want to change the model instance during the action execution phase, like when loading it from the data layer. This will result in getModel() being called at least twice.
Extending the interceptor:
There are no known extension points to this interceptor.Example code:
 
 <action name="someAction" class="com.examples.SomeAction">
     <interceptor-ref name="modelDriven"/>
     <interceptor-ref name="basicStack"/>
     <result name="success">good_result.ftl</result>
 </action>
 
 - Version:
- $Date$ $Id$
- Author:
- tm_jee
- See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionprotected static classRefreshes the model instance on the value stack, if it has changed
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionintercept(ActionInvocation invocation) Override to handle interceptionvoidsetRefreshModelBeforeResult(boolean val) Methods inherited from class org.apache.struts2.interceptor.AbstractInterceptordestroy, init, setDisabled, shouldIntercept
- 
Field Details- 
refreshModelBeforeResultprotected boolean refreshModelBeforeResult
 
- 
- 
Constructor Details- 
ModelDrivenInterceptorpublic ModelDrivenInterceptor()
 
- 
- 
Method Details- 
setRefreshModelBeforeResultpublic void setRefreshModelBeforeResult(boolean val) 
- 
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().
 
 
-