三大框架整合

来源:互联网 发布:项目管理信息系统 软件 编辑:程序博客网 时间:2024/05/19 13:26

1.添加Spring支持,选择spring,spring web库和spring-persistence库


2.添加Struts2,struts2 spring


3.添加Hibernate支持,选择使用spring的配置文件,不创建sessionFactory


4.在src目录下添加log4j.properties


5.修改web.xml,添加<context-param>和<listener>配置:
 <!-- 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
0 0
原创粉丝点击