• 关于Struts2的ONGL与ValueStack的解读


    The framework uses a standard naming context to evaluate OGNL expressions. The top level object dealing with OGNL is a Map (usually referred as a context map or context). OGNL has a notion of there being a root (or default) object within the context. In expression, the properties of the root object can be referenced without any special "marker" notion. References to other objects are marked with a pound sign (#).

       这个框架【Struts2】用一个标准的命名上下文评价OGNL表达式。处理ONGL顶层对象是一个Map集合(通常指的是一个上下文map或者上下文)

       ONGL有一个概念是在上下文中存在一个ROOT(默认)对象。在表达式中,在没有任何特殊标注的情况下根对象属性是可以被引用的,非跟对象引用要是使用“#”。

    The framework sets the OGNL context to be our ActionContext, and the value stack to be the OGNL root object. (The value stack is a set of several objects, but to OGNL it appears to be a single object.) Along with the value stack, the framework places other objects in the ActionContext, including Maps representing the application, session, and request contexts. These objects coexist in the ActionContext, alongside the value stack (our OGNL root).

        框架将设置OGNL上下文为我们ActionContext,并且值栈被设置为OGNL根对象。(值栈加入多个对象,但ONGL对外呈现一个对象)。

       与值栈一起,框架放置了其他对象在ActionContext中,包括表示引用程序的Maps,session和request Context.这些对象共存在ActionContext中,与值栈一起(我们OGNL根)

    The Action instance is always pushed onto the value stack. Because the Action is on the stack, and the stack is the OGNL root, references to Action properties can omit the # marker. But, to access other objects in the ActionContext, we must use the # notation so OGNL knows not to look in the root object, but for some other object in the ActionContext.

         Action实例通常被推送值栈上。因为Action是在栈中,并栈是在OGNL根,引用Action属性可以省略#。但是在ActionContext中访问其他对象,我们必须使用#,这样的话OGNL会知道不查询ROOT对象,会去查询其他的对象在ActionContext.

                         |--application
                         |
                         |--session
           context map---|
                         |--value stack(root)
                         |
                         |--action (the current action)
                         |
                         |--request
                         |
                         |--parameters
                         |
                         |--attr (searches page, request, session, then application scopes)
                         |
  • 相关阅读:
    BZOJ3473: 字符串
    BZOJ1088: [SCOI2005]扫雷Mine
    跪啃SAM
    BZOJ3932: [CQOI2015]任务查询系统
    BZOJ3545: [ONTAK2010]Peaks
    06.约束
    05.数据表的创建与简单操作
    04.数据库的创建
    安卓6.0后运行时权限封装
    OkGo使用缓存
  • 原文地址:https://www.cnblogs.com/flytogalaxy/p/7777082.html
Copyright © 2020-2023  润新知