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

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

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

import com.opensymphony.xwork.ActionInvocation;
import com.opensymphony.xwork.ModelDriven;
import com.opensymphony.xwork.util.OgnlValueStack;


/**
 * 
 *
 * 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. * * * *

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>
 * 
 * 
*/ public class ModelDrivenInterceptor extends AroundInterceptor { protected void after(ActionInvocation dispatcher, String result) throws Exception { } protected void before(ActionInvocation invocation) throws Exception { Object action = invocation.getAction(); if (action instanceof ModelDriven) { ModelDriven modelDriven = (ModelDriven) action; OgnlValueStack stack = invocation.getStack(); stack.push(modelDriven.getModel()); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy