Announcement Announcement Module
Collapse
No announcement yet.
contextConfigLocation Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • contextConfigLocation

    Hi

    I am trying to integrate Spring With Struts, I have registered
    <plug-in className="org.springframework.web.struts.ContextL oaderPlugIn" /> in struts-config.xml file it works fine.

    when i try to access the beans in my action class like below

    public class StrutsSpringAction extends ActionSupport{

    public ActionForward execute(ActionMapping mapping,
    ActionForm form,
    HttpServletRequest request,
    HttpServletResponse response) throws Exception{
    ApplicationContext context= (ApplicationContext) getWebApplicationContext();
    TestBean bean = (TestBean) context.getBean("springbean");
    request.setAttribute("message", bean.hi());
    return mapping.findForward("success");
    }

    }

    the bean definitions are present in the /WEB-INF/Action-servlet.xml file, but when i try to customise it by using the below

    <plug-in className="org.springframework.web.struts.ContextL oaderPlugIn">
    <set property="contextConfigLocation" value="/WEB-INF/beandef.xml" />
    </plug-in>

    it says Action not found cant find bean definition "springbean". But when i have
    [B]<plug-in className="org.springframework.web.struts.ContextL oaderPlugIn" />
    </B>

    in my struts-config.xml file and

    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/Action-servlet.xml</param-value>
    </context-param>
    in my web.xml file it works fine.

    what actually is the problem with customising contextConfigLocation through plug-in

    Thanks
    Raja
    Last edited by raja@spring; Oct 21st, 2009, 06:00 AM.

  • #2
    Hi any Updates on this.

    Comment

    Working...
    X