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)
                         |
  • 相关阅读:
    检索 COM 类工厂中 CLSID 为 {0002450000000000C000000000000046} 的组件时失败,原因是出现以下错误: 80070005。
    行列转换(sqlserver2005 的新方法)
    今天开始要详细的记录学习sharepoint 的进度和相关的一些资料
    SQL SERVER 2005 数据库状态为“可疑”的解决方法
    弹出窗口window.open()的参数列表
    C#术语&&C#关键字
    把一个 ASP.NET 程序转换为了 Web Services
    修饰符(C# 参考)
    C# 中的常用正则表达式
    1、String.format()与String.valueOf()区别 && 2、string.split()
  • 原文地址:https://www.cnblogs.com/flytogalaxy/p/7777082.html
Copyright © 2011-2022 走看看