OA自动办公系统学习

来源:互联网 发布:鬼步舞动作数据 编辑:程序博客网 时间:2024/04/27 23:06


一:创建数据库表

    create database Itcastoa default character set utf8;
    
二:环境配置
    1:struts2 配置
        导入blank 里面的几个关键jar包到Web App Library里
        拷贝web.xml到WEB-INF目录下(!!!!注意版本号就别变了也就是那些头部   除了这个拷到web下面 其他配置文件都拷到src里)
        拷贝struts2.xml到src目录下
        
        !!拷贝后它如果不会自动提示,要在windows-preferences-xml catalog里添加新配置
        \struts-2.1.8.1\src\core\src\main\resources\struts-2.1.7.dtd
        如下
        Entry element:        URI
        Location:            D:\Study\struts-2.1.8.1\src\core\src\main\resources\struts-2.1.7.dtd
        URI:                   file://D:/struts-2.1.8.1/src/core/src/main/resources/struts-2.1.7.dtd
        Key type:            URI
        Key:                http://struts.apache.org/dtds/struts-2.0.dtd
        
    2:hibernate 配置
        导入hibernate里required里的所有包 外加jpa c3p0 jdbc三个包
        文件在hibernate project里面复制
        拷贝配置文件 hibernate.cfg.xml 去以前的项目拷 并修改
            
                    <!-- Database connection settings 主要配置 -->
                    <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
                    <property name="connection.url">jdbc:mysql://localhost8080/Itcastoa</property>
                    <property name="connection.username">root</property>
                    <property name="connection.password">root</property>
                    <!-- 选用哪种数据库-->
                    <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
        
        拷贝log4j.properties
     
    3:spring 配置
        导入 disk目录下的spring.jar
        lib\aspectj\aspectjrt.jar和aspectjweacer.jar
        lib\cglib-nodep-2.1_3.jar
        lib\jakarta-commonscommons-logging.jar

        拷贝applicationContext.xml

      4: struts2 整合spring

        简单来说就两步: 1:在struts的配置文件里加spring的监听器(一启动spring就开始工作)

                                       2:加入struts2和spring链接的jar包


        具体如下:

         首先修改struts2的web文档 加入

      

      然后导入struts2包里的struts2-spring-plugin-2.1.8.1 这个包
     最后修改Spring的配置文件  让他自动扫描我们的bean

    

        这样之后struts2的配置文件里就可以直接用bean的名字了 不用写完整的文件路径

     

      


0 0
原创粉丝点击