You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Shrinivas Parashar <Sh...@symantec.com> on 2012/03/23 08:29:01 UTC

How the reset the model in session scope using ScopeModelDrivenInterceptor

HI,
I have extended the ScopeModelDrivenInterceptor to reset the model in session based on some criteria. I have overridden the resolveModel method of  ScopeModelDrivenInterceptor as below.
I am using this for wizard flow.

protected Object resolveModel(ObjectFactory factory, ActionContext actionContext, String modelClassName, String modelScope, String modelName) throws Exception {
        Object model = null;
        Map<String, Object> scopeMap = actionContext.getContextMap();
        if ("session".equals(modelScope)) {
            scopeMap = actionContext.getSession();
        }

        model = scopeMap.get(modelName);
        if (model == null || "start".equals(type)) {
            model = factory.buildBean(modelClassName, null);
            scopeMap.put(modelName, model);
        }
        return model;
    }

But still in the action class I get the original model. The model is not reset to default values.

Thanks in advance.


Regards,
Shrinivas