• 什么是ActionContext?

    ActionContext是Map结构的容器,ActionContext是Action的上下文,类比ServletContext,存放着Action执行过程中的数据信息,比如Action的数据,request的数据,session的s数据,applicaton的数据等.每次请求时会为当前线程创建一个新的ActionContext对象.通过ThreadLocal来维护当前线程的request等数据,所以ActionContext是线程安全的.

  • 获取ActionContext

    ActionContext.getContext()来获取.由于ActionContext是线程安全的,并且是通过静态方法获取的,所以在本线程的非Action类中,也可以直接访问.

    注意:ActionContext是基于请求创建的,所以在非请求的线程中是不能使用ACtionContext对象的.如filter的init()方法.

  • 什么是值栈(ValueStack)?

    ValueStack是ActionContext的一个对象,值栈是栈结构(先进先出),struts2中值栈存放的数据是Action对象,

 

相关文章:

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