zoukankan      html  css  js  c++  java
  • Spring_day04--整合struts2和spring框架

    整合struts2和spring框架

    1 把struts2的action交给spring管理

    2 实现过程

    第一步 导入struts2spring的jar包

    (1)导入用于整合的jar包

    第二步 创建action

    第三步 创建struts2核心配置文件,配置action

    (1)位置在src下面,名称是struts.xml

    第四步 web.xml中配置struts2过滤器

    第五步 导入spring的jar包

    第六步 创建spring配置文件

    (1) 引入约束

    (2) web.xml中配置spring监听器(服务器启动时加载spring配置文件

    (3) 指定spring配置文件位置(名字到监听器源代码中找)

    第七步 把action交给spring进行配置(***)

    (1)在spring配置action对象,在struts.xml中也配置action对象

    (2)解决:

    只需要在spring里面配置action对象,不要在struts.xml中配置

    加入日志文件:log4j.properties

    启动服务器访问action,控制台输出:action.......

  • 相关阅读:
    html5语法
    Addthis使用
    css font-weight原理
    css3 background
    jquery对标签属性操作
    给textarea添加背景图
    label的for属性
    css3 text-shadow
    z-index堆叠规则
    css3 @font-face
  • 原文地址:https://www.cnblogs.com/justdoitba/p/7889219.html
Copyright © 2011-2022 走看看