Struts2 OGNL 自己的一些笔记

ValueStack  值栈   是一个跟对象     可以直接访问   (是一个List


Context  是一个Map  访问的时候  需要加 # 号

所以  #  相当于 ActionContext.getContext()    

#session.msg    ==>   ActionContext.getContext().getSession().getAttribute("msg");


%  号在标志的属性为字符串类型时,计算OGNL表达式的值

The value of key "foo1" is 

不使用%:

 

使用%:


运行界面如下所示。

he value of key "foo1" is bar1

不使用%#foobar['foo1']

使用%bar1


Struts 2框架的配置文件中引用OGNL表达式   使用  $












你可能感兴趣的:(struts2,struts2)