struts  spring    想配到一起      
struts没有问题,但是两个放一起,把    .do    转      
到spring    配置的actionbean    里总不成功。页面提交后一片空白      
控制台没有错误    下面是    配置文件        struts-config.xml      
   
<struts-config>      
     <data-sources    />      
     <form-beans    >      
             <form-bean    name="StrutsFrm"    type="st.study.RegisterForm"    />      
     </form-beans>      
   
     <global-exceptions    />      
     <global-forwards    />      
     <action-mappings    >                      
       <action    path="/user"     
         type="org.springframework.web.struts.DelegatingActionProxy"      
         name="StrutsFrm"    scope="request"    validate="false"     
         parameter="method">      
        <forward    name="list"    path="/register.jsp"/>      
        <forward    name="edit"    path="/p.htm"/>      
       </action>      
     </action-mappings>      
   
 <plug-in  className="org.springframework.web.struts.ContextLoaderPlugIn">      
    <set-property    property="contextConfigLocation" 
        value="/WEB-INF/applicationContext.xml"/>      
</plug-in>      
</struts-config>      
   
applicationContext.xml      
       
<beans>      
     <bean    name="/user"    singleton="false"   
       autowire="byName" class="spr.study.RegisterAction"/>      
</beans>      
   
100分不够再加,高手帮忙         
以前没玩过    struts    spring    很不熟悉

解决方案 »

  1.   

    楼主你的这种配置方式是“Spring控制Struts模式”,好处是可以让Struts也具有IoC的能力,问题是为什么不直接用Spring的MVC模块替代Struts。
    下边我介绍常见的Struts和Spring结合模式,Struts调用Spring的服务。
    Struts独立配置,和Spring无关,你这里的struts-config.xml完全是Struts的那些东西,不要管Spring;Spring也独立配置,不要涉及Struts。
    在Struts的Action类中,增加如下内容:
        private static ApplicationContext ctx = null;
        public Object getBean(String name) {
            if (ctx == null) {
                ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(servlet.getServletContext());
            }        return ctx.getBean(name);
        }现在,在你的Action中需要用到Spring服务的地方,如execute方法中,类似如下的使用:
    UserManager um = (UserManager)getBean("userService");
    UserManager是接口,userService是你在Spring中配置的bean的id。这样就可以在Struts中调用Spring服务了。
      

  2.   

    看来只能这样了
    多谢IceCraft(心淡情浓) 了
    揭帖