web标准的存放数据的范围有:

pageContext域,request域,session域,application域(ServletContext)。

struts2自己又定义了一个容器来存放数据,即:ActionContext。

ActionContext是个Map集合,它持有了web标准的4个域,通过它可以直接获取这四个标准容器。

不仅如此,它还引用了其它struts2自己定义的对象:

详解struts2中的ActionContext(数据中心)

ActionContext的几个特点:

1,ActionContext是Strtuts2新设计出来的存储数据的容器,该容器是个Map集合,

它里面有到达各个容器(其它map)的引用,如可以获取标准的4个域容器,还有struts2自己定义的东西,如ValueStack值栈

2,我们可以通过 ActionContext方便的获取到其它容器,如同一个快捷方式,struts2的数据中心

3,ActionContext是ThreadLoacl线程绑定的, 当struts2接受到请求后,就会马上创建一个ActionContext,然后各个位置都可以获取到ActionContext

4,ActionContext意思就是action运行的上下文,负责存储action运行产生的数据

5,ActionContext它里面有个Map集合用来存储数据,但是ActionContext本身作为一个对象,它也有很多其它方法。

    ActionContext.getContext()  :获取ActionContext里的大Map集合;ActionContext.getContext().getValueStack()  //获取值栈

相关文章:

  • 2021-11-24
  • 2021-10-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-26
  • 2022-12-23
猜你喜欢
  • 2021-10-27
  • 2021-09-22
  • 2022-01-05
  • 2021-11-21
  • 2022-12-23
  • 2022-01-13
  • 2022-12-23
相关资源
相似解决方案