All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor Maven / Gradle / Ivy

Go to download

XWork is an command-pattern framework that is used to power WebWork as well as other applications. XWork provides an Inversion of Control container, a powerful expression language, data type conversion, validation, and pluggable configuration.

There is a newer version: 2.0.3
Show newest version
/*
 * Copyright (c) 2002-2006 by OpenSymphony
 * All rights reserved.
 */
package com.opensymphony.xwork2.interceptor;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.ModelDriven;
import com.opensymphony.xwork2.util.ValueStack;


/**
 * 
 *
 * Watches for {@link ModelDriven} actions and adds the action's model on to the value stack.
 *
 * 

Note: The ModelDrivenInterceptor must come before the both {@link StaticParametersInterceptor} and * {@link 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: * * * *

    * *
  • None
  • * *
* * * *

Extending the interceptor: * *

* * * * There are no known extension points to this interceptor. * * * *

Example code: * *

 * 
 * <action name="someAction" class="com.examples.SomeAction">
 *     <interceptor-ref name="model-driven"/>
 *     <interceptor-ref name="basicStack"/>
 *     <result name="success">good_result.ftl</result>
 * </action>
 * 
 * 
* * @author tm_jee * @version $Date: 2006-09-30 07:34:02 +0200 (Sat, 30 Sep 2006) $ $Id: ModelDrivenInterceptor.java 1142 2006-09-30 05:34:02Z mrdon $ */ public class ModelDrivenInterceptor extends AbstractInterceptor { public String intercept(ActionInvocation invocation) throws Exception { Object action = invocation.getAction(); if (action instanceof ModelDriven) { ModelDriven modelDriven = (ModelDriven) action; ValueStack stack = invocation.getStack(); if (modelDriven.getModel() != null) { stack.push(modelDriven.getModel()); } } return invocation.invoke(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy