Hello Struts2 Users,
I am attempting to utilize the ScopedModelDriven interceptor to manage user input across multiple form submits, in the style of a simple wizard with sequential pages of input. I have declared my Action class ('ScopedModelDrivenAction ') to implement 'ScopedModelDriven' and provided the necessary setter/getters. My param mapping is functioning properly to support ModelDriven approach, as evidenced by the previous step input available through <s:property...> in subsequent step. My issue seems to be when I apply the "<param name="scope">session</param>" to the interceptor, it has no effect. I have created a simplistic example below and included all relevant code. I have the feeling I am close, but the solution is eluding me. I have been through all the documentation I can find on "ScopedModelDriven", including the "Struts 2 in Action" book I purchased. Unfortunately I can find no complete working example of this feature. Any help is greatly appreciated. Cheers, Andy Struts.XML: <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <package name="test" namespace="/srsm" extends="struts-default"> <interceptors> <interceptor name="alias" class="com.opensymphony.xwork2.interceptor.AliasInterceptor" /> <interceptor name="autowiring" class="com.opensymphony.xwork2.spring.interceptor.ActionAutowiringInterc eptor" /> <interceptor name="chain" class="com.opensymphony.xwork2.interceptor.ChainingInterceptor" /> <interceptor name="conversionError" class="org.apache.struts2.interceptor.StrutsConversionErrorInterceptor" /> <interceptor name="createSession" class="org.apache.struts2.interceptor.CreateSessionInterceptor" /> <interceptor name="debugging" class="org.apache.struts2.interceptor.debugging.DebuggingInterceptor" /> <interceptor name="externalRef" class="com.opensymphony.xwork2.interceptor.ExternalReferencesInterceptor " /> <interceptor name="execAndWait" class="org.apache.struts2.interceptor.ExecuteAndWaitInterceptor" /> <interceptor name="exception" class="com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor" /> <interceptor name="fileUpload" class="org.apache.struts2.interceptor.FileUploadInterceptor" /> <interceptor name="i18n" class="com.opensymphony.xwork2.interceptor.I18nInterceptor" /> <interceptor name="logger" class="com.opensymphony.xwork2.interceptor.LoggingInterceptor" /> <interceptor name="modelDriven" class="com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor" /> <interceptor name="scopedModelDriven" class="com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor" /> <interceptor name="params" class="com.opensymphony.xwork2.interceptor.ParametersInterceptor" /> <interceptor name="prepare" class="com.opensymphony.xwork2.interceptor.PrepareInterceptor" /> <interceptor name="staticParams" class="com.opensymphony.xwork2.interceptor.StaticParametersInterceptor" /> <interceptor name="scope" class="org.apache.struts2.interceptor.ScopeInterceptor" /> <interceptor name="servletConfig" class="org.apache.struts2.interceptor.ServletConfigInterceptor" /> <interceptor name="sessionAutowiring" class="org.apache.struts2.spring.interceptor.SessionContextAutowiringInt erceptor" /> <interceptor name="timer" class="com.opensymphony.xwork2.interceptor.TimerInterceptor" /> <interceptor name="token" class="org.apache.struts2.interceptor.TokenInterceptor" /> <interceptor name="tokenSession" class="org.apache.struts2.interceptor.TokenSessionStoreInterceptor" /> <interceptor name="validation" class="org.apache.struts2.interceptor.validation.AnnotationValidationInt erceptor" /> <interceptor name="workflow" class="com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor" /> <interceptor name="store" class="org.apache.struts2.interceptor.MessageStoreInterceptor" /> <interceptor name="checkbox" class="org.apache.struts2.interceptor.CheckboxInterceptor" /> <interceptor name="profiling" class="org.apache.struts2.interceptor.ProfilingActivationInterceptor" /> <interceptor name="roles" class="org.apache.struts2.interceptor.RolesInterceptor" /> <interceptor-stack name="customStack"> <interceptor-ref name="exception" /> <interceptor-ref name="alias" /> <interceptor-ref name="servletConfig" /> <interceptor-ref name="prepare" /> <interceptor-ref name="i18n" /> <interceptor-ref name="chain" /> <interceptor-ref name="debugging" /> <interceptor-ref name="profiling" /> <interceptor-ref name="scopedModelDriven"> <param name="scope">session</param> </interceptor-ref> <interceptor-ref name="modelDriven" /> <interceptor-ref name="fileUpload" /> <interceptor-ref name="checkbox" /> <interceptor-ref name="staticParams" /> <interceptor-ref name="params"> <param name="excludeParams">dojo\..*</param> </interceptor-ref> <interceptor-ref name="conversionError" /> <interceptor-ref name="validation"> <param name="excludeMethods">input,back,cancel,browse</param> </interceptor-ref> <interceptor-ref name="workflow"> <param name="excludeMethods">input,back,cancel,browse</param> </interceptor-ref> </interceptor-stack> </interceptors> <action name="ScopedModelDrivenSubmit2" class="test.struts.ScopedModelDrivenAction"> <interceptor-ref name="customStack" /> <result>/srsm/test/ScopedModelDrivenResults.jsp</result> </action> <action name="ScopedModelDrivenSubmit1" class="test.struts.ScopedModelDrivenAction"> <interceptor-ref name="customStack" /> <result>/srsm/test/ScopedModelDrivenForm2.jsp</result> </action> </package> </struts> ScopedModelDrivenAction.java: package test.struts; import com.opensymphony.xwork2.ActionSupport; import com.opensymphony.xwork2.interceptor.ScopedModelDriven; public class ScopedModelDrivenAction extends ActionSupport implements ScopedModelDriven<UserModel> { private static final long serialVersionUID = 1L; private UserModel user = new UserModel(); public void setUser(UserModel usr) { user = usr; } public UserModel getUser() { return user; } /** * Implementation for ScopedModelDriven */ private String scope = ""; @Override public String getScopeKey() { return scope; } @Override public void setModel(UserModel arg0) { user = arg0; } @Override public void setScopeKey(String arg0) { scope = arg0; } @Override public UserModel getModel() { return user; } } UserModel.java: package test.struts; public class UserModel { private String firstname = ""; private String lastname = ""; public void setFirstname(String fn) { firstname = fn; } public void setLastname(String ln) { lastname = ln; } public String getFirstname() { return firstname; } public String getLastname() { return lastname; } }