I certainly did not use any of these conversation implementations (I
decided to write my own) but I suspect that you have defined the
interceptors in the opposite order: I think you should first set to
execute the defaultStack and then call the conversation interceptor.

2008/5/22, Canny Duck <[EMAIL PROTECTED]>:
>
> Hi,
>
> I want to implement a process with more than one step and a model in a
> conversation scope.
> To realize that I used the Struts 2 scope plugin.
>
> To implement the post-redirect-get pattern I have a result type of
> "redirect-action". This behave is required.
>
> The attached demo implementation worked fine, if the model property and the
> getter setter method
> is part of the called action. But if the model is declared in a BaseAction,
> the model will not be set on the Value Stack
> and the property model.page ist no set. It's think it's not a bug in the
> scope plugin, because a
> tried this
> http://www.vitarara.org/cms/struts_2_cookbook/using_a_conversation_scope
> ConversationInterceptor  and have the same problems.
>
> Here are the main classes of my demo process. You can test the attached demo
> project to see the problem:
>
> Action:
>
> public class TestAction extends BaseAction<Model> {
>
> // Working version without a BaseAction
> //public class TestAction extends ActionSupport {
> //
> //    @In(scope = ScopeType.CONVERSATION)
> //    @Out(scope = ScopeType.CONVERSATION)
> //    protected Model model;
> //
> //    public Model getModel() {
> //        return model;
> //    }
> //
> //    public void setModel(Model model) {
> //        this.model = model;
> //    }
>
>        @Begin
>        public String start() {
>                model = new Model();
>                model.setPage(1);
>                return SUCCESS;
>        }
>
>        @End
>        public String end() {
>            return "success";
>        }
> }
>
> BaseAction:
>
> public class BaseAction<TYPE> extends ActionSupport
> {
>    @In(scope = ScopeType.CONVERSATION)
>    @Out(scope = ScopeType.CONVERSATION)
>    protected TYPE model;
>
>    public TYPE getModel() {
>        return model;
>    }
>
>    public void setModel(TYPE model) {
>        this.model = model;
>    }
> }
>
> Model:
>
> public class Model
> {
>    private int page;
>
>    public int getPage() {
>        return page;
>    }
>
>    public void setPage(int page) {
>        this.page = page;
>    }
> }
>
> 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>
>
>    <constant name="struts.devMode" value="true" />
>
>    <package name="test" namespace="/" extends="struts-default">
>
>        <interceptors>
>            <interceptor name="bean-scope"
> class="com.googlecode.scopeplugin.ScopeInterceptor" />
>        </interceptors>
>
>        <action name="start" class="example.ui.TestAction" method="start">
>            <interceptor-ref name="bean-scope" />
>            <interceptor-ref name="defaultStack" />
>            <result name="success" type="redirect-action">/success</result>
>        </action>
>
>        <action name="success" class="example.ui.TestAction">
>            <interceptor-ref name="bean-scope" />
>            <interceptor-ref name="defaultStack" />
>            <result name="success">/test/start.jsp</result>
>        </action>
>
>         <action name="end" class="example.ui.TestAction" method="end">
>            <interceptor-ref name="bean-scope" />
>            <interceptor-ref name="defaultStack" />
>            <result name="success">/test/end.jsp</result>
>        </action>
>
>
>    </package>
> </struts>
>
> start.jsp:
>
> <%@ page contentType="text/html; charset=UTF-8"%>
> <%@ taglib prefix="s" uri="/struts-tags"%>
>
> <html>
> <head>
> <title>Start</title>
> </head>
>
> <body>
> <s:form action="end">
>        <!-- page is only set if no base action is used-->
>        Page: <s:property value="model.page" />
>        <s:submit value="End" />
> </s:form>
> </body>
> </html>
>
> http://www.nabble.com/file/p17404381/testapp.zip testapp.zip
> --
> View this message in context: 
> http://www.nabble.com/model-conversation-scope-doesn%27-t-work-as-property-in-a-base-action-class-tp17404381p17404381.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to