1。spring插件通过覆盖struts2的objectfactory来工作,不设置能跑起来?
不过这个覆盖用不着你来做啊,struts-plugin.xml里就有,在struts2-plugin-2.0.11.jar里
2.struts.objectFactory.spring.autoWire=auto,如果发现默认构造器,则用type方式,否则constructor
3,4待高人
不过这个覆盖用不着你来做啊,struts-plugin.xml里就有,在struts2-plugin-2.0.11.jar里
2.struts.objectFactory.spring.autoWire=auto,如果发现默认构造器,则用type方式,否则constructor
3,4待高人
Account account=new Account();
account.setCid(cid);
account.setBalance(balance);
this.getSqlMapClientTemplate().insert("insertAccount", account);
}
我现在都有点糊涂了
而且我是使用Eclipse的J2EE版本建立动态web网站开发的 直接Export *.war到Tomcat的webapps目录进行发布的 每次重新发布之后就会出现只剩下WEB-INF的文件夹 其他都不见了的情况 就只能重启Tomcat 然后才会恢复正常
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规范去写,其它都各自的要求去做即可。
struts-plugin.xml文件已经设置<constant name="struts.objectFactory" value="spring" />bean的自动装配方式默认是byName,即你的action中的属性跟spring的配置文件中的bean同名的话,spring会自动将action属性装配上
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中调用下业务逻辑层的对象中的方法