1.加入Spring支持。选择spring,spring web库和spring-persistence库
2.加入Struts2,struts2 spring
3.加入Hibernate支持,选择使用spring的配置文件,不创建sessionFactory
4.在src文件夹下加入log4j.properties
<!-- spring的配置 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/classes/applicationContext.xml
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
6.改动struts.xml,加入从对象工厂常量。值为spring,加入一个devMode方便调试
<constant name="sturts.objectFactory" value="spring"/>
<constant name="struts.devMode" value="true" />
7.部署到tomcat,删除反复的8个jar包,剩下70个jar包
8.假设启动tomcat报内存溢出的错误:
java.lang.OutOfMemoryError: PermGen space
-XX:PermSize=256m
-XX:MaxPermSize=256m