Announcement Announcement Module
No announcement yet.
Problem with Struts + Spring Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with Struts + Spring


    I'm creating Struts + Spring application.

    I'm using the DelegatingRequestProcessor class to load my action classes using spring. Now the DelegatingRequestProcessor requires the ContextLoaderPlugIn plugin that will load the spring context. The problem is that I also need to load some servlets and filters and the plugin loads the spring context after all servlet and filter init methods are called.

    One way is to solve this problem is to configure web.xml like this:

    <listener-class>org.springframework.web.context.ContextLoade rListener</listener-class>

    This way the spring context will be loaded before all servlet and filter inits methods are called. But if I use this method with the struts configuration I will load 2 spring contexts and I only need one. If I eliminate the
    ContextLoaderPlugIn plugin I get:

    java.lang.IllegalStateException: Could not find ContextLoaderPlugIn's WebApplicationContext as ServletContext attribute [org.springframework.web.struts.ContextLoaderPlugIn .CONTEXT.]

    If I leave the plugin but don't set the contextConfigLocation property I Could not open ServletContext resource [/WEB-INF/action-servlet.xml]

    So is there any way to use 1 spring context for servlet, filters and struts actions?