• SSH整合——登录模块


    1.导包——参照我的GitHub

    Hibernate

      hibernate/lib/required

      hibernate/lib/jpa

      数据库驱动

    Struts2

      struts-blank.war/WEB-INF/lib/*

      struts整合spring插件包(一旦导入,一定要启动Spring容器)

    Spring

      基本4+2

      整合web:web包

      整合aop:4个

      整合jdbc事务:3个

      junit测试:test包

    2.单独配置Spring容器

      创建配置文件,导入约束

    <beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns="http://www.springframework.org/schema/beans" 
            xmlns:context="http://www.springframework.org/schema/context"
            xmlns:aop="http://www.springframework.org/schema/aop" 
            xmlns:tx="http://www.springframework.org/schema/tx"
            xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd 
                                http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd 
                                http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.2.xsd 
                                http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.2.xsd ">
    </beans>

      配置监听器

    3.单独配置Struts2

      配置sturts.xml

    <!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
        "http://struts.apache.org/dtds/struts-2.3.dtd">
    
    <struts>
        <package name="crm" namespace="/" extends="struts-default">
            <action name="UserAction_*" class="com.littlepage.web.action.UserAction" method="{1}">
                <result name="success">/</result>
            </action>
        </package>
    </struts>

      创建action

      配置过滤器到web.xml

    4.整合Struts2和Spring

      导包

      配置常量struts.xml(将action的创建交给spring容器)

    <constant name="struts.objectFactory" value="spring"></constant>

    5.单独配置Hibernate

  • 相关阅读:
    八、drop和alter
    undefined reference to ****
    cgdb的认识
    ping: unknown host www.baidu.com
    ubuntu mysql汉字写入只写入了一个字符
    gdb map.insert方法运行异常:program received signal segmentation fault
    ubuntu环境下c++ 模板特化的编写
    putty fatal error software caused connection
    ubuntu共享文件夹不能被访问,其他主机ping不通该服务器
    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 问题
  • 原文地址:https://www.cnblogs.com/littlepage/p/10889341.html
Copyright © 2020-2023  润新知