??????????struts.xml????????????????壺

<package name="testit" namespace="/" extends="struts-default">
<interceptors>
<interceptor name="testInterceptor" class="interceptor.MyInterceptor"/>
</interceptors>
<action name="createaccount" class="action.AccountAction">
<result name="success">/index.jsp</result>
<result name="input">/createaccount.jsp</result>
<interceptor-ref name="defaultStack"/>
<interceptor-ref name="testInterceptor"/>
</action>
</package>

???????У?????????????

????before processing

????bye bye execute

????????struts???а????????????????jar??????????????plugin.jar??β??????????????struts2-spring-plugin-2.2.1.1.jar????????????????????????????????????2?????????С????spring-beans-2.5.6.jar??spring-context-2.5.6.jar?????????????????????ν????StrutsSpringTestCase????????????web.xml??????????????????????????????????

????2.StrutsSpringTestCase

???????????????????????????????????

????MathAction.java

package action;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ServletActionContext;
import service.MathService;

public class MathAction extends ActionSupport{
    private MathService service;

    public String execute() throws Exception {
        ServletActionContext.getRequest().setAttribute("add.result"??service.add(1??2));
        return SUCCESS;
    }

    public MathService getService() {
        return service;
    }

    public void setService(MathService service) {
        this.service = service;
    }
}

????MathService.java

package service;

public class MathService {
    public int add(int a??int b){
        return a+b;
    }
}