struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Canny Duck <>
Subject model conversation scope doesn' t work as property in a base action class
Date Thu, 22 May 2008 13:35:53 GMT


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 ist no set. It's think it's not a bug in the
scope plugin, because a
tried this
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:


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;
//    }
	public String start() {
		model = new Model();
		return SUCCESS;
	public String end() {
	    return "success";


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;


public class Model
    private int page;

    public int getPage() {
        return page;

    public void setPage(int page) { = page;


<?xml version="1.0" encoding="UTF-8" ?>
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"


    <constant name="struts.devMode" value="true" />

    <package name="test" namespace="/" extends="struts-default">

            <interceptor name="bean-scope"
class="com.googlecode.scopeplugin.ScopeInterceptor" />

        <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 name="success" class="example.ui.TestAction">
            <interceptor-ref name="bean-scope" />
            <interceptor-ref name="defaultStack" />
            <result name="success">/test/start.jsp</result>
         <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>



<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>


<s:form action="end">
        <!-- page is only set if no base action is used-->
	Page: <s:property value="" />
	<s:submit value="End" />
View this message in context:
Sent from the Struts - User mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message