1。spring插件通过覆盖struts2的objectfactory来工作,不设置能跑起来?
不过这个覆盖用不着你来做啊,struts-plugin.xml里就有,在struts2-plugin-2.0.11.jar里
2.struts.objectFactory.spring.autoWire=auto,如果发现默认构造器,则用type方式,否则constructor
3,4待高人

解决方案 »

  1.   

    把getSqlMapClientTemplate().insert("insertAccount", account); 加个this试试public void createAccount(final int cid,final double balance) throws DataAccessException{    
            Account account=new Account();
            account.setCid(cid);
            account.setBalance(balance);
            this.getSqlMapClientTemplate().insert("insertAccount", account);        
        }
      

  2.   

    我恰恰是没有设置跑起来了 汗
    我现在都有点糊涂了 
    而且我是使用Eclipse的J2EE版本建立动态web网站开发的 直接Export *.war到Tomcat的webapps目录进行发布的 每次重新发布之后就会出现只剩下WEB-INF的文件夹 其他都不见了的情况 就只能重启Tomcat 然后才会恢复正常
      

  3.   

    不用这么复杂,在struts.xml配置的action的class指定为Spring的Bean id就交给spring管理了(这样就集成了)。
    struts.xml:<package name="article"  extends="struts-default">
    <global-results>
      <result name="message">/message.jsp</result>
      </global-results>
      <action name="article_*" class="articleAction" method="{1}">
    <result name="list">/article_list.jsp</result>
    <result name="listAction" type="redirect-action">article_list.do</result>
    <result name="add">/article_add.jsp</result>
    </action>
    </package>
    Spring的xml配置(例如beans.xml):<bean id="articleAction" class="com.zjh.web.struts.action.ArticleAction"/>
    com.zjh.web.struts.action.ArticleAction就按Struts2规范去写,其它都各自的要求去做即可。
      

  4.   

    只要将struts2-spring-plugin.jar加入lib目录就可以了,不需要再设置struts.objectFactory = spring ,因为在struts2-spring-plugin.jar中的
    struts-plugin.xml文件已经设置<constant name="struts.objectFactory" value="spring" />bean的自动装配方式默认是byName,即你的action中的属性跟spring的配置文件中的bean同名的话,spring会自动将action属性装配上
      

  5.   

    好的 谢谢zou_wei_forever 我再试试看
      

  6.   

    1.struts.objectFactory = spring 到底要不要设置  我看到很多文章都说要设置 但是我跑起来为什么刚好是没有设置的那次 要设置!或者在xml里也可以设置<constant name="struts.objectFactory" value="spring" />2.bean的自动装配属性到底应该怎么设置  我不明白整合struts2的时候应该是使用哪种自动装配方式 或者不用 
    bean的自动装配方式默认是byName,即你的action中的属性跟spring的配置文件中的bean同名的话,spring会自动将action属性装配上
    还有一种byID的装配方式目前开发还是手动装配的多3.如果我采用 http://kaituofuture.javaeye.com/blog/294913 的 “2 使用自动装配 struts.xml配置:与不整合时配置一样。applicationContext.xml配置:业务逻辑组件的id与action中业务逻辑组件属性同名 ”来整合Struts2和Spring要怎样调试才能知道Spring接管Struts2的Bean装配了 这个就是上面说的byID手动装配,要知道是否spring依赖注入了业务逻辑层,可以在action中调用下业务逻辑层的对象中的方法