OGNL stack value 值栈(主要参考官方手册)


OGNL stack value 值栈(主要参考官方手册)


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 (#).
该框架使用标准的命名上下文来计算OGNL表达式。最顶层的对象被称为上下文context,由于它是一个Map对象,因此也被称为是context map。OGNL中有一个根对象(或者成为默认对象)root。在OGNL中使用根对象的属性时不需要加#。而访问非根对象时,需要标明#。OGNL会默认从根对象往下一层一层的查找对象(属性),如果看到开头有#,则说明希望OGNL从其他与跟对象并行的对象中查找。

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).
struts2将ActionContext设置为设置为OGNL的context,并将值栈value stack设置为OGNL的根对象。(值栈中保存了多个对象,但是对于OGNL来说值栈就是一个对象。)
除了值栈,OGNL还将其他一些对象放到了ActionContext下,包括application, session, request and attr。
这些对象鱼值栈对象并列。


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的根对象,因此OGNL访问Action中的成员属性不用加#。




 

你可能感兴趣的:(stack)