zoukankan      html  css  js  c++  java
  • 关于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)
                         |
  • 相关阅读:
    基于差分隐私的安全机制
    基于散列和RSA的纵向联邦学习样本对齐实现方案
    富文本及编辑器的跨平台方案
    计算机字符编码的前世今生
    探究Presto SQL引擎(1)-巧用Antlr
    vivo 全球商城:优惠券系统架构设计与实践
    复杂多变场景下的Groovy脚本引擎实战
    分布式存储系统可靠性:系统量化估算
    手把手教你实现Android编译期注解
    灵活运用分布式锁解决数据重复插入问题
  • 原文地址:https://www.cnblogs.com/flytogalaxy/p/7777082.html
Copyright © 2011-2022 走看看