-
Oct 21st, 2009, 04:52 AM
#1
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 at 05:00 AM.
-
Oct 22nd, 2009, 01:43 AM
#2
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules