Hi. I have been using Struts 1.2.9 for a while and just started using Spring 2.0. I am trying to integrate the two an am running into trouble. I am following Springs docs @ http:// static.springframework.org/spring/docs/2.0.x/reference/ webintegration.html#struts-actionsupport and I tried the easier of the two recommended approaches, making my actions subclass Spring's DispatchActionSupport class instead of Struts' Action class. This example below is the example given in Spring's docs.

public class UserAction extends DispatchActionSupport {

    public ActionForward execute(ActionMapping mapping,
                                 ActionForm form,
                                 HttpServletRequest request,
HttpServletResponse response) throws Exception {
        if (log.isDebugEnabled()) {
            log.debug("entering 'delete' method...");
        }
        WebApplicationContext ctx = getWebApplicationContext();
        UserManager mgr = (UserManager) ctx.getBean("userManager");
        // talk to manager for business logic
        return mapping.findForward("success");
    }
}


I am deploying to Tomcat and am getting the following error. What have been your approaches to integrate Struts and Spring?



java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered? org.springframework.web.context.support.WebApplicationContextUtils.getRe quiredWebApplicationContext(WebApplicationContextUtils.java:86) org.springframework.web.struts.DelegatingActionUtils.findRequiredWebAppl icationContext(DelegatingActionUtils.java:148) org.springframework.web.struts.DispatchActionSupport.initWebApplicationC ontext(DispatchActionSupport.java:98) org.springframework.web.struts.DispatchActionSupport.setServlet (DispatchActionSupport.java:78) org.apache.struts.action.RequestProcessor.processActionCreate (RequestProcessor.java:295) org.apache.struts.action.RequestProcessor.process (RequestProcessor.java:218)
        org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
        org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


Doug Tangren
[EMAIL PROTECTED]



Reply via email to